Smith::UI::Terminal
Inherits Reference < Object
Terminal size query and raw-mode handling. Wraps the few ioctls and termios calls the UI needs, so everything else deals in plain methods.
Constants
DEFAULT_HEIGHT = 24
DEFAULT_WIDTH = 80
TIOCGWINSZ = {% if (flag?(:darwin)) || (flag?(:bsd)) %}
0x40087468_u64
{% elsif flag?(:linux) %}
0x5413_u64
{% else %}
0_u64
{% end %}
Constructors
new(io : IO = STDOUT, input : IO = STDIN, color : Bool = true, width : Int32 | Nil = nil, height : Int32 | Nil = nil)
SourceInstance methods
clear_line
Sourceclear_resize!
Sourcecolor?
Sourcecursor_to_column(n : Int32) : Nil
Sourcecursor_up(n : Int32) : Nil
Sourceenter!
Sourceheight
Sourcehide_cursor
Sourceinstall_winch_handler
Sourceio
Sourceleave!
Sourcemark_resized!
The window changed size. Set from the SIGWINCH handler above; specs drive it directly, having no window to drag.
newline
Sourceraw?
Sourceread_key(timeout : Time::Span = 50.milliseconds) : Key
Reads a key, waiting at most timeout. Returns Tick when nothing
arrived in that window, Resized when the window changed, Eof when the
input is gone for good.
resized?
Sourceshow_cursor
Sourcesize
Sourcewidth
Sourcewrite(text : String) : Nil
Sourcewrite_line(line : StyledLine) : Nil
Source