RealTimeConsoleInput

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

struct RealTimeConsoleInput {
version(Posix)
ubyte[128] hack;
version(Windows)
HANDLE inputHandle;
void delegate(InputEvent) userEventHandler;
bool _suppressDestruction;
bool _initialized;
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)

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

injectEvent
void injectEvent(CustomEvent ce)

Injects a custom event into the terminal input queue.

integrateWithSimpleDisplayEventLoop
auto 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.

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. Note that this doesn't necessarily mean getch will not block, use this AND kbhit for that case.

Suggestion Box / Bug Report