Skip to content

Instantly share code, notes, and snippets.

@postmodern
Last active December 25, 2015 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save postmodern/6912812 to your computer and use it in GitHub Desktop.
Save postmodern/6912812 to your computer and use it in GitHub Desktop.
Example of using Curses to manage input/output text areas.
require 'curses'
Curses.init_screen
output = Curses::Window.new(Curses.lines - 1, Curses.cols, 0, 0)
output.setpos(0,0)
input = Curses::Window.new(1, Curses.cols, Curses.lines - 1, 0)
input.setpos(0,0)
loop do
output << input.getstr << "\n"
output.refresh
input.clear
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment