rubytext 0.0.91 → 0.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/demo.rb +1 -1
- data/lib/version.rb +1 -1
- data/tutorial/brackets.png +0 -0
- data/tutorial/brackets.rb +22 -0
- data/tutorial/brackets.rb.html +48 -0
- data/tutorial/color +2 -0
- data/tutorial/color1.in +4 -0
- data/tutorial/color2.in +6 -0
- data/tutorial/foo.rb +3 -0
- data/tutorial/foo.rb.html +17 -0
- data/tutorial/tutorial.html +25 -10
- data/tutorial/tutorial.lt3 +19 -12
- data/tutorial/wrap-brackets.html +50 -0
- data/tutorial/wrap-colortest.html +2 -2
- data/tutorial/wrap-hw.html +2 -2
- data/tutorial/wrap-stdscr.html +2 -2
- metadata +10 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f1e62b4c64306cc6cc302c91c1e2076fbe65026ae25769309f364f4eb5e5bb1
|
4
|
+
data.tar.gz: 98fce537c46d0bb1125428ec5cc4ea5f05f304d659dbb3ed036829a6d51a44e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18a3c303551ec815261a62eb3b15dbb2864744546262b31f3d718549184c5e991d45843a841b9ebcc6129c2b22c28fffffba08626d02a6755057b0c98d32f5c8
|
7
|
+
data.tar.gz: 5f7dfca219e5c6bcca822842935ee86087525fe224123ef6155eb08d1b09d585ecd410b6fdc14fb92d9f10e0d78cb9081ca3a92aa53d247e29217f2599fb7294
|
data/examples/demo.rb
CHANGED
@@ -104,7 +104,7 @@ end
|
|
104
104
|
delay 5
|
105
105
|
mywin.output do
|
106
106
|
mywin.clear
|
107
|
-
mywin.puts "The [] method (zero-based) is
|
107
|
+
mywin.puts "The [] method (zero-based) is available... let's try it."
|
108
108
|
mywin.puts "XYZ"
|
109
109
|
ch = mywin[2,2]
|
110
110
|
mywin.puts "The char at [2,2] is: #{ch.chr.inspect}"
|
data/lib/version.rb
CHANGED
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubytext'
|
2
|
+
|
3
|
+
RubyText.start
|
4
|
+
|
5
|
+
win = RubyText.window(16, 60, r: 3, c: 10, fg: Yellow, bg: Blue)
|
6
|
+
|
7
|
+
win.puts "ABCDE Method [] can retrieve characters "
|
8
|
+
win.puts "FGHIJ from a window."
|
9
|
+
win.puts "KLMNO\nPQRST\nUVWZYZ\n "
|
10
|
+
|
11
|
+
sleep 1
|
12
|
+
win.puts "(3,2) => '#{win[3,2]}' (0,4) => '#{win[0,4]}'"
|
13
|
+
win.puts "(7,7) => '#{win[7,7]}' (0,15) => '#{win[0,15]}'"
|
14
|
+
|
15
|
+
sleep 1
|
16
|
+
win.puts "\nAnd []= can place characters at screen locations."
|
17
|
+
|
18
|
+
sleep 1
|
19
|
+
win[12, 15] = "a"; win.refresh; sleep 0.4
|
20
|
+
win[11, 25] = "b"; win.refresh; sleep 0.4
|
21
|
+
win[10, 35] = "c"
|
22
|
+
getch
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<style type="text/css">
|
2
|
+
<!--
|
3
|
+
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
4
|
+
body { font-family: monospace; color: #ffffff; background-color: #000000; }
|
5
|
+
pre { font-size: 15 }
|
6
|
+
tt { font-size: 15 }
|
7
|
+
* { font-size: 1em; }
|
8
|
+
.Constant { color: #ff40ff; }
|
9
|
+
.Special { color: #ffff00; }
|
10
|
+
.PreProc { color: #ff40ff; }
|
11
|
+
.Type { color: #00ff00; }
|
12
|
+
-->
|
13
|
+
</style>
|
14
|
+
|
15
|
+
<script type='text/javascript'>
|
16
|
+
<!--
|
17
|
+
|
18
|
+
-->
|
19
|
+
</script>
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<pre id='vimCodeElement'>
|
23
|
+
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">rubytext</span><span class="Special">'</span>
|
24
|
+
|
25
|
+
<span class="Type">RubyText</span>.start
|
26
|
+
|
27
|
+
win = <span class="Type">RubyText</span>.window(<span class="Constant">16</span>, <span class="Constant">60</span>, <span class="Constant">r</span>: <span class="Constant">3</span>, <span class="Constant">c</span>: <span class="Constant">10</span>, <span class="Constant">fg</span>: <span class="Type">Yellow</span>, <span class="Constant">bg</span>: <span class="Type">Blue</span>)
|
28
|
+
|
29
|
+
win.puts <span class="Special">"</span><span class="Constant">ABCDE Method [] can retrieve characters </span><span class="Special">"</span>
|
30
|
+
win.puts <span class="Special">"</span><span class="Constant">FGHIJ from a window.</span><span class="Special">"</span>
|
31
|
+
win.puts <span class="Special">"</span><span class="Constant">KLMNO</span><span class="Special">\n</span><span class="Constant">PQRST</span><span class="Special">\n</span><span class="Constant">UVWZYZ</span><span class="Special">\n</span><span class="Constant"> </span><span class="Special">"</span>
|
32
|
+
|
33
|
+
sleep <span class="Constant">1</span>
|
34
|
+
win.puts <span class="Special">"</span><span class="Constant">(3,2) => '</span><span class="Special">#{</span>win[<span class="Constant">3</span>,<span class="Constant">2</span>]<span class="Special">}</span><span class="Constant">' (0,4) => '</span><span class="Special">#{</span>win[<span class="Constant">0</span>,<span class="Constant">4</span>]<span class="Special">}</span><span class="Constant">'</span><span class="Special">"</span>
|
35
|
+
win.puts <span class="Special">"</span><span class="Constant">(7,7) => '</span><span class="Special">#{</span>win[<span class="Constant">7</span>,<span class="Constant">7</span>]<span class="Special">}</span><span class="Constant">' (0,15) => '</span><span class="Special">#{</span>win[<span class="Constant">0</span>,<span class="Constant">15</span>]<span class="Special">}</span><span class="Constant">'</span><span class="Special">"</span>
|
36
|
+
|
37
|
+
sleep <span class="Constant">1</span>
|
38
|
+
win.puts <span class="Special">"</span><span class="Special">\n</span><span class="Constant">And []= can place characters at screen locations.</span><span class="Special">"</span>
|
39
|
+
|
40
|
+
sleep <span class="Constant">1</span>
|
41
|
+
win[<span class="Constant">12</span>, <span class="Constant">15</span>] = <span class="Special">"</span><span class="Constant">a</span><span class="Special">"</span>; win.refresh; sleep <span class="Constant">0.4</span>
|
42
|
+
win[<span class="Constant">11</span>, <span class="Constant">25</span>] = <span class="Special">"</span><span class="Constant">b</span><span class="Special">"</span>; win.refresh; sleep <span class="Constant">0.4</span>
|
43
|
+
win[<span class="Constant">10</span>, <span class="Constant">35</span>] = <span class="Special">"</span><span class="Constant">c</span><span class="Special">"</span>
|
44
|
+
getch
|
45
|
+
</pre>
|
46
|
+
</body>
|
47
|
+
</html>
|
48
|
+
<!-- vim: set foldmethod=manual : -->
|
data/tutorial/color
ADDED
data/tutorial/color1.in
ADDED
data/tutorial/color2.in
ADDED
data/tutorial/foo.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<script type='text/javascript'>
|
2
|
+
<!--
|
3
|
+
|
4
|
+
-->
|
5
|
+
pre { font-size: 15 }
|
6
|
+
tt { font-size: 15 }
|
7
|
+
</script>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<pre id='vimCodeElement'>
|
11
|
+
puts <span class="Special">"</span><span class="Constant">Hello</span><span class="Special">"</span>
|
12
|
+
|
13
|
+
puts <span class="Special">"</span><span class="Constant">world...</span><span class="Special">"</span>
|
14
|
+
</pre>
|
15
|
+
</body>
|
16
|
+
</html>
|
17
|
+
<!-- vim: set foldmethod=manual : -->
|
data/tutorial/tutorial.html
CHANGED
@@ -54,26 +54,28 @@ while others provide functionality unrelated to what curses provides.
|
|
54
54
|
<p>
|
55
55
|
|
56
56
|
<dl>
|
57
|
-
<dt><tt>:cbreak</tt> </dt>
|
57
|
+
<dt><b><tt>:cbreak</tt></b> </dt>
|
58
58
|
<dd> Like <tt>cbreak</tt> in curses. Inverse is <tt>:_cbreak</tt> (preferred) or <tt>:nocbreak</tt></dd>
|
59
|
-
<dt><tt>:raw</tt> </dt>
|
59
|
+
<dt><b><tt>:raw</tt></b> </dt>
|
60
60
|
<dd> Like <tt>raw</tt> in curses. Inverse is <tt>:_raw</tt> (preferred) or <tt>:noraw</tt></dd>
|
61
|
-
<dt><tt>:echo</tt> </dt>
|
61
|
+
<dt><b><tt>:echo</tt></b> </dt>
|
62
62
|
<dd> Like <tt>echo</tt> in curses. Inverse is <tt>:_echo</tt> (preferred) or <tt>:noecho</tt></dd>
|
63
|
-
<dt><tt>:keypad</tt> </dt>
|
63
|
+
<dt><b><tt>:keypad</tt></b> </dt>
|
64
64
|
<dd> Like <tt>keypad</tt> in curses. Inverse is <tt>:_keypad</tt> (preferred) or <tt>:nokeypad</tt></dd>
|
65
|
-
<dt><tt>log
|
65
|
+
<dt><b><tt>log: <i>logfile</tt></b></i> </dt>
|
66
66
|
<dd> Log debugging information to specified file.</dd>
|
67
|
-
<dt><tt>fg
|
67
|
+
<dt><b><tt>fg: <i>foreground</tt></b></i> </dt>
|
68
68
|
<dd> Set foreground color for STDSCR.</dd>
|
69
|
-
<dt><tt>bg
|
69
|
+
<dt><b><tt>bg: <i>background</tt></b></i> </dt>
|
70
70
|
<dd> Set background color for STDSCR.</dd>
|
71
|
-
<dt><tt>scroll
|
71
|
+
<dt><b><tt>scroll: <i>Boolean</tt></b></i> </dt>
|
72
72
|
<dd> Permit (or disallow) window scrolling for STDSCR.</dd>
|
73
|
+
<dt><b><tt>cursor: <i>Boolean</tt></b></i> </dt>
|
74
|
+
<dd> Turn the cursor on or off.</dd>
|
73
75
|
</dl>
|
74
76
|
<p>
|
75
77
|
|
76
|
-
The defaults are as follows:
|
78
|
+
The defaults for <tt>STDSCR</tt> are as follows:
|
77
79
|
<p>
|
78
80
|
|
79
81
|
<pre>
|
@@ -115,9 +117,22 @@ to "cheat" when these two are the same, presumably to preserve legibility.)
|
|
115
117
|
</iframe>
|
116
118
|
<p>
|
117
119
|
|
120
|
+
You can use <tt></tt> to retrieve characters from the screen as though it were a
|
121
|
+
two-dimensional array. Similarly, <tt></tt>= will set characters.
|
118
122
|
<p>
|
119
123
|
|
120
|
-
|
124
|
+
<!-- high = 252 hcode = 509 -->
|
125
|
+
<iframe frameborder=0
|
126
|
+
width=782 height=509
|
127
|
+
src='wrap-brackets.html'>
|
128
|
+
</iframe>
|
129
|
+
<p>
|
130
|
+
|
131
|
+
<p>
|
132
|
+
|
133
|
+
<p>
|
134
|
+
|
135
|
+
<h3>More later...</h3>
|
121
136
|
<p>
|
122
137
|
|
123
138
|
<p>
|
data/tutorial/tutorial.lt3
CHANGED
@@ -31,9 +31,9 @@ but it _can be.)
|
|
31
31
|
hmax = [high, hcode].max # Code may be longer than screenshot height
|
32
32
|
_puts "<!-- high = #{high} hcode = #{hcode} -->"
|
33
33
|
File.open("wrap-#{arg}.html", "w") do |f|
|
34
|
-
f.puts "<table width=100% cellpadding=2><tr><td width=
|
34
|
+
f.puts "<table width=100% cellpadding=2><tr><td width=60% valign=top>"
|
35
35
|
f.puts code
|
36
|
-
f.puts "</td><td width=
|
36
|
+
f.puts "</td><td width=40% valign=top><img src=#{sshot} valign=top></td></tr></table>"
|
37
37
|
end
|
38
38
|
_puts <<-HTML
|
39
39
|
<iframe frameborder=0
|
@@ -67,18 +67,19 @@ are keyword arguments. If you know curses, some of these will be familiar,
|
|
67
67
|
while others provide functionality unrelated to what curses provides.
|
68
68
|
|
69
69
|
.dlist |
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
70
|
+
$$bt[:cbreak] | Like `cbreak in curses. Inverse is `:\_cbreak (preferred) or `:nocbreak
|
71
|
+
$$bt[:raw] | Like `raw in curses. Inverse is `:\_raw (preferred) or `:noraw
|
72
|
+
$$bt[:echo] | Like `echo in curses. Inverse is `:\_echo (preferred) or `:noecho
|
73
|
+
$$bt[:keypad] | Like `keypad in curses. Inverse is `:\_keypad (preferred) or `:nokeypad
|
74
|
+
$$bt[log: _logfile] | Log debugging information to specified file.
|
75
|
+
$$bt[fg: _foreground] | Set foreground color for STDSCR.
|
76
|
+
$$bt[bg: _background] | Set background color for STDSCR.
|
77
|
+
$$bt[scroll: _Boolean] | Permit (or disallow) window scrolling for STDSCR.
|
78
|
+
$$bt[cursor: _Boolean] | Turn the cursor on or off.
|
78
79
|
.end
|
79
80
|
|
80
81
|
|
81
|
-
The defaults are as follows:
|
82
|
+
The defaults for `STDSCR are as follows:
|
82
83
|
|
83
84
|
.mono
|
84
85
|
RubyText.start(:cbreak, :_raw, :_echo, :keypad, log: "/tmp/rubytext.log",
|
@@ -122,8 +123,14 @@ to "cheat" when these two are the same, presumably to preserve legibility.)
|
|
122
123
|
|
123
124
|
.example colortest 16
|
124
125
|
|
126
|
+
You can use `[] to retrieve characters from the screen as though it were a
|
127
|
+
two-dimensional array. Similarly, `[]= will set characters.
|
125
128
|
|
126
|
-
|
129
|
+
.example brackets 22
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<h3>More later...</h3>
|
127
134
|
|
128
135
|
|
129
136
|
.cleanup toc.tmp
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<table width=100% cellpadding=2><tr><td width=60% valign=top>
|
2
|
+
<style type="text/css">
|
3
|
+
<!--
|
4
|
+
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
5
|
+
body { font-family: monospace; color: #ffffff; background-color: #000000; }
|
6
|
+
pre { font-size: 15 }
|
7
|
+
tt { font-size: 15 }
|
8
|
+
* { font-size: 1em; }
|
9
|
+
.Constant { color: #ff40ff; }
|
10
|
+
.Special { color: #ffff00; }
|
11
|
+
.PreProc { color: #ff40ff; }
|
12
|
+
.Type { color: #00ff00; }
|
13
|
+
-->
|
14
|
+
</style>
|
15
|
+
|
16
|
+
<script type='text/javascript'>
|
17
|
+
<!--
|
18
|
+
|
19
|
+
-->
|
20
|
+
</script>
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
<pre id='vimCodeElement'>
|
24
|
+
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">rubytext</span><span class="Special">'</span>
|
25
|
+
|
26
|
+
<span class="Type">RubyText</span>.start
|
27
|
+
|
28
|
+
win = <span class="Type">RubyText</span>.window(<span class="Constant">16</span>, <span class="Constant">60</span>, <span class="Constant">r</span>: <span class="Constant">3</span>, <span class="Constant">c</span>: <span class="Constant">10</span>, <span class="Constant">fg</span>: <span class="Type">Yellow</span>, <span class="Constant">bg</span>: <span class="Type">Blue</span>)
|
29
|
+
|
30
|
+
win.puts <span class="Special">"</span><span class="Constant">ABCDE Method [] can retrieve characters </span><span class="Special">"</span>
|
31
|
+
win.puts <span class="Special">"</span><span class="Constant">FGHIJ from a window.</span><span class="Special">"</span>
|
32
|
+
win.puts <span class="Special">"</span><span class="Constant">KLMNO</span><span class="Special">\n</span><span class="Constant">PQRST</span><span class="Special">\n</span><span class="Constant">UVWZYZ</span><span class="Special">\n</span><span class="Constant"> </span><span class="Special">"</span>
|
33
|
+
|
34
|
+
sleep <span class="Constant">1</span>
|
35
|
+
win.puts <span class="Special">"</span><span class="Constant">(3,2) => '</span><span class="Special">#{</span>win[<span class="Constant">3</span>,<span class="Constant">2</span>]<span class="Special">}</span><span class="Constant">' (0,4) => '</span><span class="Special">#{</span>win[<span class="Constant">0</span>,<span class="Constant">4</span>]<span class="Special">}</span><span class="Constant">'</span><span class="Special">"</span>
|
36
|
+
win.puts <span class="Special">"</span><span class="Constant">(7,7) => '</span><span class="Special">#{</span>win[<span class="Constant">7</span>,<span class="Constant">7</span>]<span class="Special">}</span><span class="Constant">' (0,15) => '</span><span class="Special">#{</span>win[<span class="Constant">0</span>,<span class="Constant">15</span>]<span class="Special">}</span><span class="Constant">'</span><span class="Special">"</span>
|
37
|
+
|
38
|
+
sleep <span class="Constant">1</span>
|
39
|
+
win.puts <span class="Special">"</span><span class="Special">\n</span><span class="Constant">And []= can place characters at screen locations.</span><span class="Special">"</span>
|
40
|
+
|
41
|
+
sleep <span class="Constant">1</span>
|
42
|
+
win[<span class="Constant">12</span>, <span class="Constant">15</span>] = <span class="Special">"</span><span class="Constant">a</span><span class="Special">"</span>; win.refresh; sleep <span class="Constant">0.4</span>
|
43
|
+
win[<span class="Constant">11</span>, <span class="Constant">25</span>] = <span class="Special">"</span><span class="Constant">b</span><span class="Special">"</span>; win.refresh; sleep <span class="Constant">0.4</span>
|
44
|
+
win[<span class="Constant">10</span>, <span class="Constant">35</span>] = <span class="Special">"</span><span class="Constant">c</span><span class="Special">"</span>
|
45
|
+
getch
|
46
|
+
</pre>
|
47
|
+
</body>
|
48
|
+
</html>
|
49
|
+
<!-- vim: set foldmethod=manual : -->
|
50
|
+
</td><td width=40% valign=top><img src=brackets.png valign=top></td></tr></table>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=60% valign=top>
|
2
2
|
<style type="text/css">
|
3
3
|
<!--
|
4
4
|
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
|
@@ -56,4 +56,4 @@ getch
|
|
56
56
|
</body>
|
57
57
|
</html>
|
58
58
|
<!-- vim: set foldmethod=manual : -->
|
59
|
-
</td><td width=
|
59
|
+
</td><td width=40% valign=top><img src=colortest.png valign=top></td></tr></table>
|
data/tutorial/wrap-hw.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=60% valign=top>
|
2
2
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
@@ -40,4 +40,4 @@ getch
|
|
40
40
|
</body>
|
41
41
|
</html>
|
42
42
|
<!-- vim: set foldmethod=manual : -->
|
43
|
-
</td><td width=
|
43
|
+
</td><td width=40% valign=top><img src=hw.png valign=top></td></tr></table>
|
data/tutorial/wrap-stdscr.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<table width=100% cellpadding=2><tr><td width=
|
1
|
+
<table width=100% cellpadding=2><tr><td width=60% valign=top>
|
2
2
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
@@ -56,4 +56,4 @@ getch
|
|
56
56
|
</body>
|
57
57
|
</html>
|
58
58
|
<!-- vim: set foldmethod=manual : -->
|
59
|
-
</td><td width=
|
59
|
+
</td><td width=40% valign=top><img src=stdscr.png valign=top></td></tr></table>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubytext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
@@ -87,9 +87,17 @@ files:
|
|
87
87
|
- lib/window.rb
|
88
88
|
- test/auto.rb
|
89
89
|
- tutorial/basic.css
|
90
|
+
- tutorial/brackets.png
|
91
|
+
- tutorial/brackets.rb
|
92
|
+
- tutorial/brackets.rb.html
|
93
|
+
- tutorial/color
|
94
|
+
- tutorial/color1.in
|
95
|
+
- tutorial/color2.in
|
90
96
|
- tutorial/colortest.png
|
91
97
|
- tutorial/colortest.rb
|
92
98
|
- tutorial/colortest.rb.html
|
99
|
+
- tutorial/foo.rb
|
100
|
+
- tutorial/foo.rb.html
|
93
101
|
- tutorial/hw.png
|
94
102
|
- tutorial/hw.rb
|
95
103
|
- tutorial/hw.rb.html
|
@@ -99,6 +107,7 @@ files:
|
|
99
107
|
- tutorial/stdscr.rb.html
|
100
108
|
- tutorial/tutorial.html
|
101
109
|
- tutorial/tutorial.lt3
|
110
|
+
- tutorial/wrap-brackets.html
|
102
111
|
- tutorial/wrap-colortest.html
|
103
112
|
- tutorial/wrap-hw.html
|
104
113
|
- tutorial/wrap-stdscr.html
|