rubytext 0.0.78 → 0.0.79
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/output.rb +44 -14
- data/lib/settings.rb +3 -1
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 575b3566044a490f9c1f1616882b453fc812521fba5ef1e26e2f497932bddf63
|
4
|
+
data.tar.gz: 83c79003049e00fdcb0cd1a234f7fad54ec237b663ace9d6632c29ac6a244c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 778b0e9d83e375f2edc7c232e4c126838f19996b6d561714cc38fd44bc76b36cbdbc75a8bd672d82a5ebf92a66dd6f433ee74ae3aa1057d49553ff0bea92a1cc
|
7
|
+
data.tar.gz: e07bb935388fc39eadb7d5961d5b42b98e50597db2950966d80654a9047aa294e05760e691ba8cef1673e5fbaf6d466bf0fdddd8ad0b8e5004ea27d36df669bb
|
data/lib/output.rb
CHANGED
@@ -113,10 +113,10 @@ class RubyText::Window
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def clear
|
116
|
-
num =
|
117
|
-
home
|
118
|
-
@cwin.addstr(' '*
|
119
|
-
home
|
116
|
+
num = self.rows * self.cols
|
117
|
+
self.home
|
118
|
+
self.rows.times { @cwin.addstr(' '*self.cols); @cwin.refresh }
|
119
|
+
self.home
|
120
120
|
@cwin.refresh
|
121
121
|
end
|
122
122
|
|
@@ -147,6 +147,44 @@ class RubyText::Window
|
|
147
147
|
def refresh
|
148
148
|
@cwin.refresh
|
149
149
|
end
|
150
|
+
|
151
|
+
def gets # still needs improvement
|
152
|
+
# echo assumed to be OFF, keypad ON
|
153
|
+
str = ""
|
154
|
+
i = 0
|
155
|
+
r0, c0 = self.rc
|
156
|
+
loop do
|
157
|
+
ch = self.getch
|
158
|
+
debug "gets: found #{ch.inspect}; cursor at #{self.rc.inspect}"
|
159
|
+
case ch
|
160
|
+
when 10 # Enter
|
161
|
+
self.crlf
|
162
|
+
break
|
163
|
+
when 8, 127, 63 # backspace, del, ^H (huh?)
|
164
|
+
if i >= 1
|
165
|
+
str = str[0..-2]
|
166
|
+
i -= 1
|
167
|
+
self.left
|
168
|
+
self[*self.rc] = ' '
|
169
|
+
self.left
|
170
|
+
end
|
171
|
+
when 260 # left-arrow
|
172
|
+
i -= 1
|
173
|
+
self.left
|
174
|
+
when 261 # right-arrow
|
175
|
+
i += 1
|
176
|
+
self.right
|
177
|
+
else
|
178
|
+
debug " case 3 (#{ch.inspect})"
|
179
|
+
str.insert(i, ch)
|
180
|
+
self.right
|
181
|
+
self.go(r0, c0) { self.print str }
|
182
|
+
i += 1
|
183
|
+
end
|
184
|
+
end
|
185
|
+
str
|
186
|
+
end
|
187
|
+
|
150
188
|
end
|
151
189
|
|
152
190
|
# into top level...
|
@@ -179,16 +217,8 @@ module WindowIO
|
|
179
217
|
end
|
180
218
|
|
181
219
|
def gets # still needs improvement
|
182
|
-
|
183
|
-
|
184
|
-
ch = ::STDSCR.getch
|
185
|
-
if ch == 10
|
186
|
-
::STDSCR.crlf
|
187
|
-
break
|
188
|
-
end
|
189
|
-
str << ch
|
190
|
-
end
|
191
|
-
str
|
220
|
+
recv = RubyText.started ? $stdscr : Kernel
|
221
|
+
recv.gets
|
192
222
|
end
|
193
223
|
|
194
224
|
def putch(ch, r: nil, c: nil, fx: nil)
|
data/lib/settings.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module RubyText
|
2
2
|
# Hmm, all these are module-level.
|
3
3
|
|
4
|
-
ValidArgs = [:raw, :_raw, :echo, :_echo, :cbreak, :_cbreak]
|
4
|
+
ValidArgs = [:raw, :_raw, :echo, :_echo, :cbreak, :_cbreak, :keypad, :_keypad]
|
5
5
|
|
6
6
|
def self.started
|
7
7
|
@started
|
8
8
|
end
|
9
9
|
|
10
|
+
$debugging = true
|
11
|
+
|
10
12
|
def self.start(*args, log: "/tmp/rubytext.log",
|
11
13
|
fg: White, bg: Blue, scroll: false)
|
12
14
|
$debug ||= File.new(log, "w") if log # FIXME remove global
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.79
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|