lib/menu.rb in rubytext-0.0.52 vs lib/menu.rb in rubytext-0.0.53
- old
+ new
@@ -22,20 +22,20 @@
def self.menu(r: 0, c: 0, items:, curr: 0)
high = items.size + 2
wide = items.map(&:length).max + 4
saveback(high, wide, r, c)
- win = RubyText.window(high, wide, r, c, true, fg: :white, bg: :blue)
+ win = RubyText.window(high, wide, r, c, fg: White, bg: Blue)
RubyText.set(:raw)
X.stdscr.keypad(true)
RubyText.hide_cursor
sel = curr
max = items.size - 1
loop do
items.each.with_index do |item, row|
win.go row, 0
- color = sel == row ? :yellow : :white
+ color = sel == row ? Yellow : White
win.puts color, " #{item} "
end
ch = getch
case ch
when X::KEY_UP
@@ -55,11 +55,11 @@
def selector(r: 0, c: 0, rows: 10, cols: 20, items:,
win:, callback:, quit: "q")
high = rows
wide = cols
saveback(high, wide, r, c)
- menu_win = RubyText.window(high, wide, r, c, true, fg: :white, bg: :blue)
+ menu_win = RubyText.window(high, wide, r, c, fg: White, bg: Blue)
win2 = win
handler = callback
RubyText.set(:raw)
X.stdscr.keypad(true)
RubyText.hide_cursor
@@ -67,10 +67,10 @@
max = items.size - 1
handler.call(0, items[0])
loop do
items.each.with_index do |item, row|
menu_win.go row, 0
- color = sel == row ? :yellow : :white
+ color = sel == row ? Yellow : White
menu_win.puts color, " #{item} "
end
ch = getch
case ch
when X::KEY_UP