RealTimeConsoleInput

Encapsulates the stream of input events received from the terminal input.

struct RealTimeConsoleInput {
version(Posix)
ubyte[128] hack;
version(Win32Console)
HANDLE inputHandle;
void delegate(InputEvent) userEventHandler;
bool _suppressDestruction;
version(Posix)
int delegate(char) inputPrefilter;
InputEvent[] inputQueue;
}

Constructors

this
this(Terminal* terminal, ConsoleInputFlags flags)

To capture input, you need to provide a terminal and some flags.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

getch
dchar getch(bool nonblocking = false)

Get one key press from the terminal, discarding other events in the process. Returns dchar.init upon receiving end-of-file.

integrateWithSimpleDisplayEventLoop
void integrateWithSimpleDisplayEventLoop(void delegate(InputEvent) userEventHandler)

If you are using arsd.simpledisplay and want terminal interop too, you can call this function to add it to the sdpy event loop and get the callback called on new input.

kbhit
bool kbhit()

Returns true if there iff getch() would not block.

nextEvent
InputEvent nextEvent()

Returns the next event. Experimental: It is also possible to integrate this into a generic event loop, currently under -version=with_eventloop and it will require the module arsd.eventloop (Linux only at this point)

requestPasteFromClipboard
void requestPasteFromClipboard()
requestPasteFromPrimary
void requestPasteFromPrimary()

Requests the system to send paste data as a PasteEvent to this stream, if possible.

timedCheckForInput
bool timedCheckForInput(int milliseconds)

Check for input, waiting no longer than the number of milliseconds

Meta