rubytext 0.0.69 → 0.0.70
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/effects.rb +6 -5
- data/lib/menu.rb +4 -4
- data/lib/output.rb +16 -5
- 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: 22c0e83ef4094786d7d68439b96647488238c2b10eb5b686b7229815528e351f
|
4
|
+
data.tar.gz: 8b745f93f8c98c5701135bafd757a9892abe49697c26733cad6660b039451e60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c098bc1edf777f7ff66c07b8b5154049bcacffb1f81f1621302e2fd0568c35e51e7aab4f9c72f76d714c4ec68f5bbb3bf4bbcfb6240ce67aa5deb5e7ee45fd5f
|
7
|
+
data.tar.gz: 33a09d6e1ae1fd78c931ca7f1590ea89704b5d5b83df83a544c28fd5a23644f7691f8746f49b1d5816998334d7029023f898ba2a32b137883eee397bf026f64a
|
data/lib/effects.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
class RubyText::Effects # dumb name?
|
2
2
|
Modes = {bold: X::A_BOLD,
|
3
|
-
normal: X::
|
4
|
-
reverse: X::
|
5
|
-
under: X::
|
3
|
+
normal: X::A_NORMAL,
|
4
|
+
reverse: X::A_REVERSE,
|
5
|
+
under: X::A_UNDERLINE}
|
6
|
+
|
6
7
|
|
7
8
|
Others = %[:show, :hide] # show/hide cursor; more later??
|
8
9
|
|
@@ -10,16 +11,16 @@ class RubyText::Effects # dumb name?
|
|
10
11
|
|
11
12
|
def initialize(win, *args)
|
12
13
|
bits = 0
|
14
|
+
@list = args
|
13
15
|
args.each do |arg|
|
14
16
|
if Modes.keys.include?(arg)
|
15
17
|
val = Modes[arg]
|
16
|
-
bits
|
18
|
+
bits |= val
|
17
19
|
elsif ::Colors.include?(arg)
|
18
20
|
@fg = arg # symbol
|
19
21
|
end
|
20
22
|
end
|
21
23
|
@value = bits
|
22
|
-
X.attrset(bits)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
data/lib/menu.rb
CHANGED
@@ -65,15 +65,15 @@ module RubyText
|
|
65
65
|
RubyText.set(:raw)
|
66
66
|
X.stdscr.keypad(true)
|
67
67
|
RubyText.hide_cursor
|
68
|
+
norm = RubyText::Effects.new(:normal, White)
|
69
|
+
rev = RubyText::Effects.new(:reverse, White)
|
68
70
|
sel = 0
|
69
71
|
max = items.size - 1
|
70
72
|
send(handler, sel, items[sel], win2)
|
71
73
|
loop do
|
72
74
|
items.each.with_index do |item, row|
|
73
|
-
menu_win.
|
74
|
-
|
75
|
-
rev = RubyText::Effects.new(:reverse, White)
|
76
|
-
style = sel == row ? Yellow : White
|
75
|
+
menu_win.left
|
76
|
+
style = (sel == row) ? rev : norm
|
77
77
|
menu_win.puts style, " #{item} "
|
78
78
|
end
|
79
79
|
ch = getch
|
data/lib/output.rb
CHANGED
@@ -20,24 +20,35 @@ class RubyText::Window
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def delegate_output(sym, *args)
|
23
|
+
self.cwin.attrset(0)
|
23
24
|
args = [""] if args.empty?
|
24
25
|
args += ["\n"] unless sym == :print
|
25
|
-
|
26
|
+
debug "\ndelegate_output:"
|
27
|
+
debug " 1. args = #{args.inspect}"
|
28
|
+
set_colors(@fg, @bg)
|
29
|
+
debug " set colors: #{[@fg, @bg].inspect}"
|
26
30
|
if sym == :p
|
27
|
-
args.map!(
|
31
|
+
args.map! {|x| effect?(x) ? x : x.inspect }
|
32
|
+
debug " 2. args = #{args.inspect}"
|
28
33
|
else
|
29
34
|
args.map! {|x| effect?(x) ? x : x.to_s }
|
35
|
+
debug " 3. args = #{args.inspect}"
|
30
36
|
end
|
31
37
|
args.each do |arg|
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
debug " loop: arg = #{arg.inspect}"
|
39
|
+
if arg.is_a?(RubyText::Effects)
|
40
|
+
debug " arg.value = #{arg.value.inspect}, fg = #{arg.fg.inspect}"
|
41
|
+
self.cwin.attrset(arg.value)
|
42
|
+
debug " set colors = #{[arg.fg, @bg]}"
|
35
43
|
self.set_colors(arg.fg, @bg) if arg.fg
|
36
44
|
else
|
45
|
+
debug " printing arg = #{arg.inspect}"
|
37
46
|
arg.each_char {|ch| ch == "\n" ? crlf : @cwin.addch(ch) }
|
47
|
+
@cwin.refresh
|
38
48
|
end
|
39
49
|
end
|
40
50
|
set_colors(@fg, @bg)
|
51
|
+
debug " set colors: #{[@fg, @bg].inspect}"
|
41
52
|
@cwin.refresh
|
42
53
|
end
|
43
54
|
|
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.70
|
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-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|