diff options
| author | dam <dam@gudinoff> | 2024-01-01 19:15:55 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2024-01-01 19:15:55 +0000 |
| commit | ac9e0033f39a9f2feaa024024a7c443d4e6df77f (patch) | |
| tree | e9061746899389665f487a8b57dc3d6b83858963 | |
| parent | 6dd12d2c8b81cd5719fb0ecdcbf678e08460fbeb (diff) | |
| download | task-time-tracker-ac9e0033f39a9f2feaa024024a7c443d4e6df77f.tar.zst task-time-tracker-ac9e0033f39a9f2feaa024024a7c443d4e6df77f.zip | |
Added some TODO items and fixed show_processing procedure.
| -rw-r--r-- | TUI/module.jai | 17 | ||||
| -rw-r--r-- | ttt.jai | 8 |
2 files changed, 18 insertions, 7 deletions
diff --git a/TUI/module.jai b/TUI/module.jai index 95ab8dc..8c1d7ed 100644 --- a/TUI/module.jai +++ b/TUI/module.jai @@ -542,7 +542,8 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key { return xx Keys.None; } -get_str :: (count_limit: int = -1) -> string { +// TODO Maybe rename!? Or replace with read_string... or read_input... or something else?! +get_string :: (count_limit: int = -1) -> string { assert_is_initialized(); if count_limit < 0 { @@ -565,6 +566,16 @@ get_str :: (count_limit: int = -1) -> string { } } +read_string :: (count_limit: int = -1) -> string, Key { + // TODO WIP FIXME WIP + /* + Use the get_key to read user input and show it on screen... should allow to move the cursor left and right and to delete/backspace. + Enter should be used to end the input. + Escape should discard the input returning an empty string and a Enter key. + Resize should discard the input returning an empty string and a Resize key. + */ +} + start :: () { if initialized == true return; @@ -658,7 +669,7 @@ get_terminal_size :: () -> rows: int, columns: int { flush_input(); write_string(Commands.QueryWindowSizeInChars); - input := get_str(64,, temporary_allocator); + input := get_string(64,, temporary_allocator); // Expected response format: \e[8;<r>;<c>t // where <r> is the number of rows and <c> of columns. @@ -699,7 +710,7 @@ get_cursor_position :: () -> row: int, column: int { flush_input(); write_string(Commands.QueryCursorPosition); - input := get_str(64,, temporary_allocator); + input := get_string(64,, temporary_allocator); // Expected response format: \e[<r>;<c>R // where <r> is the number of rows and <c> of columns. @@ -167,8 +167,9 @@ trigger_autosave :: () { } show_processing :: () { - //mvaddch(0, 0, ACS_DIAMOND); TODO DAM - //refresh(); TODO DAM + TUI.set_cursor_position(1, 1); + // TODO Maybe add some color? + write_strings(TUI.Commands.DrawingMode, TUI.Drawings.Diamond, TUI.Commands.TextMode); } // Returns true if string to_compare is equal to any of the other passed strings, false otherwise. @@ -1955,8 +1956,7 @@ main :: () { if (error_saving) { print_error("Press any key to close."); draw_error_window(); - //timeout(INPUT_AWAIT_INF); TODO DAM - //getch(); TODO DAM + TUI.get_key(); } TUI.stop(); |
