Class TermInfo
In: lib/terminfo.rb
terminfo.c
Parent: Object

Methods

Classes and Modules

Class TermInfo::TermInfoError

Attributes

io  [R] 

Public Class methods

TermInfo.tiocgwinsz(io) => [row, col]

TermInfo.tiocgwinsz returns the screen size of the terminal refered by io, using TIOCGWINSZ ioctl.

TermInfo.tiocswinsz(io, row, col)

TermInfo.tiocgwinsz update the screen size information of the terminal refered by io, using TIOCSWINSZ ioctl.

It returns nil.

Public Instance methods

TermInfo#control controls a terminal.

It prints the result of control_string to io specified at initialization.

TermInfo#control_string return a string to control terminal.

  TermInfo#control_string([afflines,] capname, p1, p2, ...)

capname is a terminfo string capability such as "cuu", "el".

p1, p2, … are parameters for the capability.

afflines is a number of lines affected. (used for determining padding length)

returns terminal screen width.

screen_height()

Alias for screen_lines

returns terminal screen height.

returns terminal screen size in a two element array: [lines, columns].

screen_width()

Alias for screen_columns

TermInfo#setupterm(term, fd) => int

TermInfo#setupterm initializes TermInfo object.

term is a string of nil. If nil is given, the environment variable $TERM is used.

fd is a file descriptor for target terminal.

TermInfo#tigetflag(capname) => int

TermInfo#tigetflag returns a boolean capability specified by capname.

TermInfo#tigetnum(capname) => int

TermInfo#tigetnum returns a numeric capability specified by capname.

TermInfo#tigetstr(capname) => str

TermInfo#tigetstr returns a string capability specified by capname.

The return value should be printed after tputs is applied. Also tparm should be applied if it has parameters.

  io.print ti.tputs(ti.tparm(ti.tigetstr("cuf"), 2))

Note that "cuf" means "cursor forward".

TermInfo#tparm(str, …) => str

TermInfo#tparm expands parameters in str returned by tigetstr.

TermInfo#tputs(str, affcnt) => str

TermInfo#tputs expands padding informaiton using padding characters. affcnt is a number of lines affected by the str.

[Validate]