lib/menu.rb in rubytext-0.0.87 vs lib/menu.rb in rubytext-0.0.88
- old
+ new
@@ -3,16 +3,23 @@
def self.menu(win: STDSCR, r: 0, c: 0, items:, curr: 0,
title: nil, fg: White, bg: Blue)
RubyText.hide_cursor
high = items.size + 2
wide = items.map(&:length).max + 4
- tlen = title.length + 6
+ tlen = title.length + 8
wide = [wide, tlen].max
win.saveback(high, wide, r, c)
- mr, mc = r+win.r0+1, c+win.c0+1
+ mr, mc = r+win.r0, c+win.c0
+ debug "menu: rc = #{[r,c].inspect} win r0c0 = #{[win.r0, win.c0].inspect}"
+# debug " and mr,mc = #{[mr,mc].inspect}"
mwin = RubyText.window(high, wide, r: mr, c: mc,
fg: fg, bg: bg)
- win.go(mr-2, mc-win.c0) { win.print fx("[ #{title} ]", :bold, fg, bg: bg) } unless title.nil?
+
+ unless title.nil?
+ win.go(r-1, c+1) do # same row as corner but farther right
+ win.print fx("[ #{title} ]", :bold, fg, bg: bg)
+ end
+ end
X.stdscr.keypad(true)
sel = curr
max = items.size - 1
norm = RubyText::Effects.new(:normal)