aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2024-01-02 01:48:31 +0000
committerdam <dam@gudinoff>2024-01-02 01:48:31 +0000
commit698836ed1c6a9175903edd41f4cafdf7cb4b946d (patch)
tree755bc2fef4b667696408aa2aa191eae7e9426855 /ttt.jai
parentac9e0033f39a9f2feaa024024a7c443d4e6df77f (diff)
downloadtask-time-tracker-698836ed1c6a9175903edd41f4cafdf7cb4b946d.tar.zst
task-time-tracker-698836ed1c6a9175903edd41f4cafdf7cb4b946d.zip
Initial implementation of procedure to read user input from a single line.
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai31
1 files changed, 31 insertions, 0 deletions
diff --git a/ttt.jai b/ttt.jai
index 62c2e6c..4e63204 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -1364,6 +1364,37 @@ main :: () {
print("size(CxR): %x%\n", xcolumns, xrows);
}
+ if 1 {
+ print("TEST : user input --\n", to_standard_error = true);
+ auto_release_temp();
+ TUI.start();
+ TUI.clear_terminal();
+ TUI.set_cursor_position(1, 1);
+ print("Enter some text (use Enter to finish, Esc to cancel, or resize to abort):");
+ TUI.set_cursor_position(2, 1);
+ str, key := TUI.user_line_input();
+ TUI.set_cursor_position(3, 1);
+ if key == {
+ case TUI.Keys.Escape; {
+ print("Have you pressed Esc? (y/n)");
+ assert(TUI.get_key() == #char "y", "Failed to read line on Esc.");
+ print("> success\n", to_standard_error = true);
+ }
+
+ case TUI.Keys.Resize; {
+ print("Have you resized the terminal? (y/n)");
+ assert(TUI.get_key() == #char "y", "Failed to read line on resize.");
+ print("> success\n", to_standard_error = true);
+ }
+ case; {
+ print("Have you entered '%'? (y/n)", str);
+ assert(TUI.get_key() == #char "y", "Failed to read line.");
+ print("> success\n", to_standard_error = true);
+ }
+ }
+ TUI.stop();
+ }
+
// -- -- -- Testing TUI -- STOP