diff options
| author | dam <dam@gudinoff> | 2024-05-08 16:20:07 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2024-05-08 16:20:07 +0100 |
| commit | 2dd22e4847b7bc239f129c5ed2e7d0bdff38006e (patch) | |
| tree | 4e3b49a120ca99acc0708fb0a3cefddc659829c4 /modules/TUI/module.jai | |
| parent | 89157d00fc4110055d5816cd1897e4def120bcaf (diff) | |
| download | task-time-tracker-2dd22e4847b7bc239f129c5ed2e7d0bdff38006e.tar.zst task-time-tracker-2dd22e4847b7bc239f129c5ed2e7d0bdff38006e.zip | |
Improved code readability.
Diffstat (limited to 'modules/TUI/module.jai')
| -rw-r--r-- | modules/TUI/module.jai | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai index 612f93e..112c666 100644 --- a/modules/TUI/module.jai +++ b/modules/TUI/module.jai @@ -560,9 +560,12 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { case; if is_escape_code(key) continue; - buff_idx := get_byte_idx(str, idx); key_str := to_string(key,, allocator = temporary_allocator); + // Get the buffer index to insert the next character. + buff_idx, success := get_byte_index(str, idx); + if success == false then buff_idx = str.count; + // Make sure we have space to append the new character at the end (in case we're trying to do it). if buff_idx > count_limit - key_str.count then continue; |
