This weekend I wrote a ruby module that aims to provide a friendlier
interface to the [n]Curses terminal I/O library.
Currently it supports the basic wholesome goodness that’s required to
get keystroke input, and to put all sorts of colorful text and
characters anywhere on the screen (though due to Curses’s weird
COLOR_PAIR system, I haven’t yet added support for background colors
other than black (though right now I’m smacking my forehead for
forgetting to add support for reverse-video, which, while not as nice
as being able to support arbitrary foreground-background color pairs
on-the-fly, still seems like something nice to have. Reverse-video
will be in the next release, I promise.
Also, the module has built-in signal handlers to gracefully (and
automatically) handle things like xterm resizes, and keyboard
interrupts (apparently nCurses “steals” SIGINT from ruby – this
module’s signal handler simply gives it back, as an Interrupt
exception that you can rescue like any other.)
Download CursWrap at:
http://drphoto.homeunix.net/software/curswrap-0.1.1.tar.bz2
(The 0.1.1 is completely arbitrary…
Refer to Build.txt for instructions on compiling the module
(Essentialy just the typical ./extconf.rb && make ), and Doc.txt for
a reference on module functions, constants, and class(es).
Bug reports, feature requests, comments, suggestions, critique, and
rants are appreciated. (Well, maybe not so much the rants…
Most importantly, if you like this module, or find it useful or
helpful, let me know!