Wednesday, 15 June 2011

ruby - Curses.getstr cleans windows on the first call -



ruby - Curses.getstr cleans windows on the first call -

the first curses.getstr phone call clears window. on later calls doesn't happen.

require "curses" curses.init_screen window = curses::window.new(10, 10, 5, 0) window.scrollok true thread.new loop window.addstr rand(1000000).to_s window.refresh sleep 0.1 end end curses.setpos 20, 0 sleep 1 # several lines of numbers disappear loop{ curses.getstr }

how can fighting behaviour?

what you're seeing implicit refresh() of stdscr window -- because getstr() wgetstr(stdscr). options include 1. manually refreshing stdscr before drawing anything, 2. using new window input, rather stdscr, and/or 3. using stdscr output. @ least, that's reply i'd give curses' native c -- i'm not sure how translates ruby.

ruby curses

No comments:

Post a Comment