From 3a949ea9f18d06bbefc73da8ca0c1051252ca96d Mon Sep 17 00:00:00 2001 From: dam Date: Wed, 20 Dec 2023 10:00:44 +0000 Subject: Trying to fix get_key to behave well when it's buffer is full. --- ttt.jai | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'ttt.jai') diff --git a/ttt.jai b/ttt.jai index aeb5b37..80d89bf 100644 --- a/ttt.jai +++ b/ttt.jai @@ -1179,7 +1179,6 @@ read_enter_confirmation :: inline (row: int, style: int, message: string) -> boo return read_input_char(row, style, message) == #char "\n"; } -// main :: () {} main :: () { // -- -- -- Testing TUI -- START @@ -1249,25 +1248,34 @@ main :: () { print("> success\n", to_standard_error = true); } - #if 0 { + #if 1 { print("test 5\n", to_standard_error = true); TUI.start(); TUI.set_terminal_title("bazinga"); xcolumns, xrows: int; key: TUI.Key = #char "d"; last_none_char := "X"; + drop_down := 0; while(key != #char "q") { // __mark := get_temporary_storage_mark(); if key == { - case xx TUI.Keys.None; { + case TUI.Keys.None; { TUI.set_cursor_position(2, 2); last_none_char = ifx last_none_char == "X" then "+" else "X"; write_string(last_none_char); } - case xx TUI.Keys.Resize; { + case TUI.Keys.Resize; #through; + case #char "c"; { TUI.clear_terminal(); + drop_down = 0; + } + + case; { + TUI.set_cursor_position(3+drop_down, 2); + write_string(TUI.to_string(key)); + drop_down += 1; } } size_r, size_c := TUI.get_terminal_size(); -- cgit v1.2.3