I have been writing an ncurses campfire client hobostove and recently gave a presentation on using Ncurses and Ruby.
Hobostove uses the ncurses-ruby gem. It’s pretty old but so is Ncurses. Here I’ll give the basics of setting up, refreshing, and tearing down. I’ll do a panel usage post later.
Initialization
Ncurses.initscr
Ncurses.cbreak
Ncurses.noecho
Ncurses.initscr
- sets up NcursesNcurses.cbreak
- don’t wait for a new line to send characters toNcurses.getch
Ncurses.noecho
- don’t echo typed characters to the screen
Update
Ncurses.doupdate
Ncurses.refresh
Ncurses.doupdate
- compares the virtual screen to the physical screen and updates accordinglyNcurses.refresh
- writes to the terminal
Tear down
Ncurses.echo
Ncurses.endwin
Ncurses.echo
- echos characters back to the screenNcurses.endwin
- stops ncurses