Issue #8121 has been reported by hramrach (Michal Suchanek). ---------------------------------------- Feature #8121: updated Curses::Window example https://bugs.ruby-lang.org/issues/8121 Author: hramrach (Michal Suchanek) Status: Open Priority: Normal Assignee: Category: Target version: The example on http://ruby-doc.org/stdlib-2.0/libdoc/curses/rdoc/... produces somewhat garbled output. Subwindow can be used to avoid that: require 'curses' Curses.init_screen() my_str = "LOOK! PONIES!" bwin = Curses::Window.new( 10, (my_str.length + 10), (Curses.lines - 10) / 2, (Curses.cols - (my_str.length + 10)) / 2 ) bwin.box("\\", "/") bwin.refresh win = bwin.subwin( 6, my_str.length + 6, (Curses.lines - 6) / 2, (Curses.cols - (my_str.length + 6)) / 2 ) win.setpos(2,3) win.addstr(my_str) # or even win << "\nORLY" win << "\nYES!! " + my_str win.refresh win.getch win.close
on 2013-03-19 03:06
on 2013-03-19 17:55
Issue #8121 has been updated by drbrain (Eric Hodel). Category set to doc Target version set to current: 2.1.0 ---------------------------------------- Feature #8121: updated Curses::Window example https://bugs.ruby-lang.org/issues/8121#change-37739 Author: hramrach (Michal Suchanek) Status: Open Priority: Normal Assignee: Category: doc Target version: current: 2.1.0 The example on http://ruby-doc.org/stdlib-2.0/libdoc/curses/rdoc/... produces somewhat garbled output. Subwindow can be used to avoid that: require 'curses' Curses.init_screen() my_str = "LOOK! PONIES!" bwin = Curses::Window.new( 10, (my_str.length + 10), (Curses.lines - 10) / 2, (Curses.cols - (my_str.length + 10)) / 2 ) bwin.box("\\", "/") bwin.refresh win = bwin.subwin( 6, my_str.length + 6, (Curses.lines - 6) / 2, (Curses.cols - (my_str.length + 6)) / 2 ) win.setpos(2,3) win.addstr(my_str) # or even win << "\nORLY" win << "\nYES!! " + my_str win.refresh win.getch win.close
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.