From 63b3eebe7196c79909f0bdcef06c861b695fa6b8 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sat, 27 May 2017 10:16:08 -0400 Subject: [PATCH] missing paren --- terminal.d | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/terminal.d b/terminal.d index 945dd21..92d6f85 100644 --- a/terminal.d +++ b/terminal.d @@ -64,6 +64,8 @@ module arsd.terminal; /++ + $(H3 Get Line) + This example will demonstrate the high-level getline interface. The user will be able to type a line and navigate around it with cursor keys and even the mouse on some systems, as well as perform editing as they expect (e.g. the backspace and delete keys work normally) until they press enter. Then, the final line will be returned to your program, which the example will simply print back to the user. @@ -79,6 +81,8 @@ unittest { } /++ + $(H3 Color) + This example demonstrates color output, using [Terminal.color] and the output functions like [Terminal.writeln]. +/ @@ -93,6 +97,24 @@ unittest { } } +/++ + $(H3 Single Key) + + This shows how to get one single character press using + the [RealTimeConsoleInput] structure. ++/ +unittest { + import arsd.terminal; + void main() { + auto terminal = Terminal(ConsoleOutputType.linear); + auto input = RealTimeConsoleInput(&terminal, ConsoleInputFlags.raw); + + terminal.writeln("Press any key to continue..."); + auto ch = input.getch(); + terminal.writeln("You pressed ", ch); + } +} + /* Widgets: tab widget @@ -2540,7 +2562,7 @@ struct InputEvent { @property Terminal* terminal() { return term; } /++ - Gets the specific event instance. First, check the type (such as in a `switch` statement, then extract the correct one from here. Note that the template argument is a $(B value type of the enum above), not a type argument. So to use it, do $(D event.get!(InputEvent.Type.KeyboardEvent)), for example. + Gets the specific event instance. First, check the type (such as in a `switch` statement), then extract the correct one from here. Note that the template argument is a $(B value type of the enum above), not a type argument. So to use it, do $(D event.get!(InputEvent.Type.KeyboardEvent)), for example. See_Also: