diff options
| -rw-r--r-- | TUI/examples/snake.jai | 2 | ||||
| -rw-r--r-- | TUI/key_map.jai | 2 | ||||
| -rw-r--r-- | TUI/module.jai | 2 | ||||
| -rw-r--r-- | TUI/tests.jai | 9 |
4 files changed, 7 insertions, 8 deletions
diff --git a/TUI/examples/snake.jai b/TUI/examples/snake.jai index b62136c..b290d27 100644 --- a/TUI/examples/snake.jai +++ b/TUI/examples/snake.jai @@ -124,7 +124,7 @@ game_loop :: () { last_pos := snake_parts[snake_parts.count-1]; // Update snake position. - for < snake_parts.count-1..1 { + for #v2 < 1..snake_parts.count-1 { if snake_parts[it] != snake_parts[it-1] { snake_parts[it] = snake_parts[it-1]; } diff --git a/TUI/key_map.jai b/TUI/key_map.jai index 43762f4..ce31389 100644 --- a/TUI/key_map.jai +++ b/TUI/key_map.jai @@ -11,6 +11,8 @@ setup_key_map :: () { if key_map.count > 0 then return; + init(*key_map); + /* This table was created/tested using the following terminals: - g: gnome terminal diff --git a/TUI/module.jai b/TUI/module.jai index 1ed950b..13f8183 100644 --- a/TUI/module.jai +++ b/TUI/module.jai @@ -609,7 +609,7 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { if buff_idx > count_limit - key_str.count then continue; // Move text to allow inserting new character. - for < count_limit-1..buff_idx + key_str.count-1 { + for #v2 < buff_idx + key_str.count-1..count_limit-1 { str.data[it] = str.data[it-key_str.count]; } diff --git a/TUI/tests.jai b/TUI/tests.jai index a740e6b..7e591b8 100644 --- a/TUI/tests.jai +++ b/TUI/tests.jai @@ -10,7 +10,7 @@ main :: () { } else { assert(TUI.reset_terminal(), "Failed to reset TUI."); - print("- ERROR: %", error_message, to_standard_error = true); + print("- ERROR: %\n", error_message, to_standard_error = true); exit(1); } } @@ -19,7 +19,7 @@ main :: () { x, y := TUI.get_cursor_position(); TUI.set_cursor_position(1, y+1); } - + if 1 { print("TEST : set and get cursor position\n", to_standard_error = true); assert(TUI.setup_terminal(), "Failed to setup TUI."); @@ -157,12 +157,9 @@ main :: () { TUI.set_cursor_position(x, y); print("size = %x%\n", width, height); key = TUI.get_key(1000); - - // __mark := get_temporary_storage_mark(); - // set_temporary_storage_mark(__mark); } - print("- success"); assert(TUI.reset_terminal(), "Failed to reset TUI."); + assert_result(true, ""); } if 1 { |
