module

Term2::Terminal

Terminal provides utilities for controlling terminal behavior

Class methods

clear(io : IO = STDOUT)

Clear the screen and move cursor to home position

Source
clear_entire_line(io : IO = STDOUT)

Clear entire line

Source
clear_line(io : IO = STDOUT)

Clear from cursor to end of line

Source
clear_to_end(io : IO = STDOUT)

Clear from cursor to end of screen

Source
disable_bracketed_paste(io : IO = STDOUT)

Disable bracketed paste mode

Source
disable_focus_reporting(io : IO = STDOUT)

Disable focus reporting

Source
enable_bracketed_paste(io : IO = STDOUT)

Enable bracketed paste mode

Source
enable_focus_reporting(io : IO = STDOUT)

Enable focus reporting

Source
enter_alt_screen(io : IO = STDOUT)

Enter alternate screen mode

Source
exit_alt_screen(io : IO = STDOUT)

Exit alternate screen mode

Source
hide_cursor(io : IO = STDOUT)

Hide the cursor

Source
home(io : IO = STDOUT)

Move cursor to home position (top-left)

Source
move_down(n : Int32 = 1, io : IO = STDOUT)

Move cursor down n lines

Source
move_left(n : Int32 = 1, io : IO = STDOUT)

Move cursor left n columns

Source
move_right(n : Int32 = 1, io : IO = STDOUT)

Move cursor right n columns

Source
move_to(row : Int32, col : Int32, io : IO = STDOUT)

Move cursor to specific position (1-based row, col)

Source
move_up(n : Int32 = 1, io : IO = STDOUT)

Move cursor up n lines

Source
raw(io : IO, &)

Enable raw mode on an IO (typically STDIN) Returns a block that can be used to restore the original mode Typically you should use the block form: raw(io) { ... }

Source
release_terminal(io : IO = STDOUT)

Release terminal (restore original state)

Source
restore_cursor(io : IO = STDOUT)

Restore cursor position

Source
restore_state(io : IO = STDOUT)

Restore terminal state

Source
restore_terminal(io : IO = STDOUT)

Restore terminal to program state

Source
save_cursor(io : IO = STDOUT)

Save cursor position

Source
save_state(io : IO = STDOUT)

Save terminal state (cursor position, attributes, etc.)

Source
set_window_title(io : IO, title : String)

Set the terminal window title

Source
show_cursor(io : IO = STDOUT)

Show the cursor

Source
size

Get terminal size using ioctl

Source
supports_raw?(io : IO) : Bool

Check if IO supports raw mode

Source
tty?(io : IO = STDOUT) : Bool

Check if output is a terminal

Source