rubytext 0.0.69 → 0.0.70

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05ecb544b4d51313454758aa89eeb5997ced7b0cc8c8dc5e5609c842957d9aea
4
- data.tar.gz: 943e529d5da7f1eba8826e4702e6dd9c12fe644664012af610796805f419b21b
3
+ metadata.gz: 22c0e83ef4094786d7d68439b96647488238c2b10eb5b686b7229815528e351f
4
+ data.tar.gz: 8b745f93f8c98c5701135bafd757a9892abe49697c26733cad6660b039451e60
5
5
  SHA512:
6
- metadata.gz: 06273a824f50b4248fdddda9e72d2c967a42e56a04edbece55af9a0c9a4e80cc45e8c96ad5dc588a277f8d7619e4b2a3b2386f5f6ff9a8844138f1bbd1198c0c
7
- data.tar.gz: 3360acf134a66130a6e9aaa373b6ac951af363ff01dcffdea667aa931c2e7d2cf5767b42b626b51370de30d9ab9de1b5d6285803b0193960c293fe7b443ff552
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:: A_NORMAL,
4
- reverse: X:: A_REVERSE,
5
- under: X:: A_UNDERLINE}
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 ||= val
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.go row, 0
74
- norm = RubyText::Effects.new(:normal, White)
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
- set_colors(@fg, @bg) # FIXME?
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!(&:inspect)
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
- case
33
- when arg.is_a?(RubyText::Effects)
34
- X.attrset(arg.value)
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
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.0.69"
3
+ VERSION = "0.0.70"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
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.69
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-01 00:00:00.000000000 Z
11
+ date: 2018-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses