rubytext 0.0.90 → 0.0.91
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/lib/version.rb +1 -1
- data/tutorial/tutorial.html +1 -1
- metadata +1 -4
- data/examples/crap.rb +0 -16
- data/tutorial/damn.rb +0 -10
- data/tutorial/meh.html +0 -124
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b23a4e0478075bafac38de7829253948415489d8a89821fc14b5f8bf26249fc
|
4
|
+
data.tar.gz: a4208a1e9cb17ea9356e84eecdb8375d8dd5e98d74140b986cce2bc5be2a4aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32aa922cf8c42f0432c1f5677a39ef74aca76cbab9238860bb0f7e7d4423f923635cc0188d24571eb63f736f9242db1ab904a3a0b7b98454affb13b70add39d1
|
7
|
+
data.tar.gz: f5279f6e09c086f8b4705b830696404d772b27184776548d8f8d62adede94daa18f5e17b83c9be8fd01c638c88f87500149bc849a943283d785c6c4aedea142d
|
data/lib/version.rb
CHANGED
data/tutorial/tutorial.html
CHANGED
@@ -94,7 +94,7 @@ the <tt>cbreak</tt> and <tt>raw</tt> modes. Let's clear it up a little with thes
|
|
94
94
|
<li>The same interrupts are <i>not</i> honored by <tt>raw</tt>; instead, they are read as characters.</li>
|
95
95
|
<li>Finally, <tt>cbreak</tt> mode overrides <tt>raw</tt> mode if they are specified together.</li>
|
96
96
|
</ul>
|
97
|
-
As
|
97
|
+
As for colors: The defaults of <tt>White</tt> and <tt>Blue</tt> are purely arbitrary. They may change.
|
98
98
|
<p>
|
99
99
|
|
100
100
|
The standard curses implementation recognizes eight colors: <tt>Black</tt>, <tt>Blue</tt>, <tt>Cyan</tt>,
|
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.91
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
@@ -45,7 +45,6 @@ files:
|
|
45
45
|
- examples/brackets.rb
|
46
46
|
- examples/center_meth.rb
|
47
47
|
- examples/check.rb
|
48
|
-
- examples/crap.rb
|
49
48
|
- examples/demo.rb
|
50
49
|
- examples/detect_rc.rb
|
51
50
|
- examples/duh
|
@@ -91,11 +90,9 @@ files:
|
|
91
90
|
- tutorial/colortest.png
|
92
91
|
- tutorial/colortest.rb
|
93
92
|
- tutorial/colortest.rb.html
|
94
|
-
- tutorial/damn.rb
|
95
93
|
- tutorial/hw.png
|
96
94
|
- tutorial/hw.rb
|
97
95
|
- tutorial/hw.rb.html
|
98
|
-
- tutorial/meh.html
|
99
96
|
- tutorial/modes.txt
|
100
97
|
- tutorial/stdscr.png
|
101
98
|
- tutorial/stdscr.rb
|
data/examples/crap.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'rubytext'
|
2
|
-
|
3
|
-
RubyText.start
|
4
|
-
|
5
|
-
STDSCR.go 1, 2
|
6
|
-
STDSCR.putch "0"
|
7
|
-
|
8
|
-
STDSCR.putch '1', r: 3, c: 6, fx: RubyText::Effects.new(Red)
|
9
|
-
STDSCR.putch '2', r: 5, c: 10, fx: RubyText::Effects.new(Yellow, :reverse)
|
10
|
-
STDSCR.putch '3', r: 7, c: 14
|
11
|
-
STDSCR.putch '4', r: 9, c: 18, fx: RubyText::Effects.new(Green, :normal)
|
12
|
-
STDSCR.putch '5', r: 11, c: 22, fx: RubyText::Effects.new(Red, :normal)
|
13
|
-
|
14
|
-
STDSCR.home
|
15
|
-
|
16
|
-
getch
|
data/tutorial/damn.rb
DELETED
data/tutorial/meh.html
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
<style>
|
2
|
-
pre {font-size: 15}
|
3
|
-
tt {font-size: 15}
|
4
|
-
</style>
|
5
|
-
<h1>RubyText
|
6
|
-
</h1>
|
7
|
-
<p>
|
8
|
-
|
9
|
-
RubyText is a curses wrapper. The modern variant is ncurses, and there are also
|
10
|
-
others. This tutorial doesn't cover much of "real" curses, as the aim is to
|
11
|
-
wrap it and make it simpler.
|
12
|
-
<p>
|
13
|
-
|
14
|
-
This project is somewhat in its infancy. Once it is a little more mature, I
|
15
|
-
hope to produce an Elixir version. (Elixir is not usually used at the desktop,
|
16
|
-
but it <i>can</i> be.)
|
17
|
-
<p>
|
18
|
-
|
19
|
-
Let's start at the beginning with the overused "hello world" example.
|
20
|
-
<p>
|
21
|
-
|
22
|
-
<!-- high = 215 hcode = 165 -->
|
23
|
-
<iframe frameborder=0
|
24
|
-
width=566 height=215
|
25
|
-
src='wrap-hw.html'>
|
26
|
-
</iframe>
|
27
|
-
<p>
|
28
|
-
|
29
|
-
Here are some things to notice:
|
30
|
-
<ul>
|
31
|
-
<li>Obviously you have to require the <tt>rubytext</tt> library.</li>
|
32
|
-
<li>You have to invoke <tt>RubyText.start</tt> (possibly with parameters).</li>
|
33
|
-
<li>When the curses environment is started, things like <tt>puts</tt> are overridden.</li>
|
34
|
-
<li>We call <tt>getch</tt> here (get a character) to make the program "pause" so as not to exit before we see anything.</li>
|
35
|
-
<li>At program exit, your screen will be restored to normal.</li>
|
36
|
-
</ul>
|
37
|
-
Here's another example.
|
38
|
-
<p>
|
39
|
-
|
40
|
-
<!-- high = 277 hcode = 465 -->
|
41
|
-
<iframe frameborder=0
|
42
|
-
width=870 height=465
|
43
|
-
src='wrap-stdscr.html'>
|
44
|
-
</iframe>
|
45
|
-
<p>
|
46
|
-
|
47
|
-
<h3>The start method
|
48
|
-
</h3>
|
49
|
-
<p>
|
50
|
-
|
51
|
-
The <tt>start</tt> method can take a number of parameters, some of which
|
52
|
-
are keyword arguments. If you know curses, some of these will be familiar,
|
53
|
-
while others provide functionality unrelated to what curses provides.
|
54
|
-
<p>
|
55
|
-
|
56
|
-
<dl>
|
57
|
-
<dt><tt>:cbreak</tt> </dt>
|
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>
|
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>
|
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>
|
64
|
-
<dd> Like <tt>keypad</tt> in curses. Inverse is <tt>:_keypad</tt> (preferred) or <tt>:nokeypad</tt></dd>
|
65
|
-
<dt><tt>log:</tt> <i>logfile</i> </dt>
|
66
|
-
<dd> Log debugging information to specified file.</dd>
|
67
|
-
<dt><tt>fg:</tt> <i>foreground</i> </dt>
|
68
|
-
<dd> Set foreground color for STDSCR.</dd>
|
69
|
-
<dt><tt>bg:</tt> <i>background</i> </dt>
|
70
|
-
<dd> Set background color for STDSCR.</dd>
|
71
|
-
<dt><tt>scroll:</tt> <i>Boolean</i> </dt>
|
72
|
-
<dd> Permit (or disallow) window scrolling for STDSCR.</dd>
|
73
|
-
</dl>
|
74
|
-
<p>
|
75
|
-
|
76
|
-
The defaults are as follows:
|
77
|
-
<p>
|
78
|
-
|
79
|
-
<pre>
|
80
|
-
RubyText.start(:cbreak, :_raw, :_echo, :keypad, log: "/tmp/rubytext.log",
|
81
|
-
fg: White, bg: Blue, scroll: true)
|
82
|
-
|
83
|
-
# can be abbreviated simply:
|
84
|
-
|
85
|
-
RubyText.start
|
86
|
-
</pre>
|
87
|
-
If you're a relative curses newbie (like me), you may have some confusion about
|
88
|
-
the <tt>cbreak</tt> and <tt>raw</tt> modes. Let's clear it up a little with these four facts.
|
89
|
-
<p>
|
90
|
-
|
91
|
-
<ul>
|
92
|
-
<li>First of all, <i>neither</i> of these permits buffered keyboard input or line editing (such as backspace).</li>
|
93
|
-
<li>As for interrupts such as <tt>^C</tt> and <tt>^Z</tt>, <tt>cbreak</tt> <i>permits</i> these (handles them as usual).</li>
|
94
|
-
<li>The same interrupts are <i>not</i> honored by <tt>raw</tt>; instead, they are read as characters.</li>
|
95
|
-
<li>Finally, <tt>cbreak</tt> mode overrides <tt>raw</tt> mode if they are specified together.</li>
|
96
|
-
</ul>
|
97
|
-
As to colors, the defaults of <tt>White</tt> and <tt>Blue</tt> are purely arbitrary. They may change.
|
98
|
-
<p>
|
99
|
-
|
100
|
-
The standard curses implementation recognizes eight colors: <tt>Black</tt>, <tt>Blue</tt>, <tt>Cyan</tt>,
|
101
|
-
<tt>Green</tt>, <tt>Magenta</tt>, <tt>Red</tt>, <tt>White</tt>, <tt>Yellow</tt>. Each of these constants refers to a symbol
|
102
|
-
of the same (lowercased) name. What these colors look like in your own local environment
|
103
|
-
may depend on many factors such as your operating system and terminal driver.
|
104
|
-
<p>
|
105
|
-
|
106
|
-
My own environment is iterm on Mac OSX with fairly standard settings. Here is some code
|
107
|
-
that will display all 64 possibilities of foreground/background. (Note that curses seems
|
108
|
-
to "cheat" when these two are the same, presumably to preserve legibility.)
|
109
|
-
<p>
|
110
|
-
|
111
|
-
<!-- high = 248 hcode = 521 -->
|
112
|
-
<iframe frameborder=0
|
113
|
-
width=828 height=521
|
114
|
-
src='wrap-colortest.html'>
|
115
|
-
</iframe>
|
116
|
-
<p>
|
117
|
-
|
118
|
-
<p>
|
119
|
-
|
120
|
-
That's all for now.
|
121
|
-
<p>
|
122
|
-
|
123
|
-
<p>
|
124
|
-
|