class Curses::Screen
Description¶ ↑
A Screen represents a terminal. A program that outputs to more than one terminal should create a Screen
for each terminal instead of calling Curses.init_screen.
Usage¶ ↑
require "curses" screen = Screen.new(STDOUT, STDIN, "xterm") screen.set_term Curses.addstr("Hit any key") Curses.refresh Curses.getch Curses.close_screen
Public Class Methods
Source
static VALUE
screen_initialize(int argc, VALUE *argv, VALUE obj)
{
VALUE outf, inf, type;
struct screendata *screenp;
rb_io_t *outfptr, *infptr;
rb_scan_args(argc, argv, "21", &outf, &inf, &type);
TypedData_Get_Struct(obj, struct screendata, &screendata_type, screenp);
if (screenp->screen) delscreen(screenp->screen);
Check_Type(outf, T_FILE);
RB_IO_POINTER(outf, outfptr);
rb_io_check_writable(outfptr);
Check_Type(inf, T_FILE);
RB_IO_POINTER(inf, infptr);
rb_io_check_readable(infptr);
screenp->screen = newterm(NIL_P(type) ? NULL : StringValueCStr(type),
rb_io_stdio_file(outfptr),
rb_io_stdio_file(infptr));
screenp->stdscr_value = Qnil;
return obj;
}
Construct a new Curses::Screen.
Public Instance Methods
Source
static VALUE
screen_set_term(VALUE obj)
{
struct screendata *screenp;
GetSCREEN(obj, screenp);
set_term(screenp->screen);
if (NIL_P(screenp->stdscr_value)) {
screenp->stdscr_value = prep_window(cWindow, stdscr, 1);
}
rb_stdscr = screenp->stdscr_value;
return Qnil;
}
Set the current terminal.