module Tput::Input

Included Modules

Direct including types

Defined in:

tput/input.cr

Constant Summary

Log = ::Log.for((self.name.gsub("::", '.')).underscore)

Instance Method Summary

Instance Method Detail

def disable_bracketed_paste : Nil #

Disables bracketed paste (DEC private mode 2004).


[View source]
def disable_in_band_resize : Nil #

Disables in-band resize notifications (DEC private mode 2048).


[View source]
def enable_bracketed_paste : Nil #

Enables bracketed paste (DEC private mode 2004). Pasted text then arrives as the paste argument of #listen instead of individual key presses. Harmless on unsupporting terminals.


[View source]
def enable_in_band_resize : Nil #

Enables in-band resize notifications (DEC private mode 2048). Resize reports then arrive as the resize argument of #listen (in addition to any SIGWINCH). Harmless on unsupporting terminals.


[View source]
def listen(& : InputEvent -> Nil) #

Reads input until EOF or #stop_listen, yielding each parsed event.

#stop_listen ends the loop at once even while it waits for input, and nothing typed is lost to it: what was read but not yet delivered is the first thing the next #listen on the same input reads.


[View source]
def listening? : Bool #

Whether a #listen is running (and was not stopped).


[View source]
def next_char(timeout : Bool | Time::Span = false, io : IO = listen_io, &) #

Reads the next char of input, or nil on EOF/timeout, and appends it to the array the block returns. timeout is true for the escape timeout (#read_timeout), or a span of its own.


[View source]
def stop_listen : Nil #

Ends the running #listen, also one waiting for input: it returns without yielding again. Input it had read but not delivered, and all input from then on, is left for the next #listen on the same input (or, unread, for a query made in between). A no-op when none is running.

A #listen waiting in an input that is no file descriptor cannot be woken: it returns when that read does, handing on what it read.


[View source]
def with_raw_input(&) #

Enables raw (unbuffered, non-cooked) input for the duration of the block.


[View source]
def with_sync_output(&) #

Enables synced (unbuffered) output for the duration of the block.


[View source]