Last active
December 25, 2015 03:49
-
-
Save postmodern/6912812 to your computer and use it in GitHub Desktop.
Example of using Curses to manage input/output text areas.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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