diff options
| author | dam <dam@gudinoff> | 2023-11-21 02:12:50 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-11-21 02:12:50 +0000 |
| commit | 53f82bca92edbe4a8883c713c30d5ac81897a43f (patch) | |
| tree | 8977f61398524e30d617e65a75aa051a6f312b91 /TUI/module.jai | |
| parent | 52ae0bb03c0dec13875d05b68e0f7912e5df8f23 (diff) | |
| download | task-time-tracker-53f82bca92edbe4a8883c713c30d5ac81897a43f.tar.zst task-time-tracker-53f82bca92edbe4a8883c713c30d5ac81897a43f.zip | |
Added comment describing next TODO.
Diffstat (limited to 'TUI/module.jai')
| -rw-r--r-- | TUI/module.jai | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/TUI/module.jai b/TUI/module.jai index 332f7c5..a12b762 100644 --- a/TUI/module.jai +++ b/TUI/module.jai @@ -82,22 +82,21 @@ Commands :: struct { // TODO Maybe make the OS_* procedures as inline?! +// Let's return keys with 32bits so we can merge up to 4bytes and support UTF-8 encoding. +Key :: u32; + +// Terminal action codes are encoded with values incompatible with UTF-8 to avoid collisions. +Keys :: enum Key { + None :: 0xFF000000; + Resize :: 0xFF000001; +} + initialized := false; input_buffer : [64] u8; input_string : string; input_override : Key; -// TODO WIP WIP WIP -// >>>>>>>>>>>>>>>>> Decide what we'll use as Key... and start fixing the types used on the procedures. -; - -Key :: u32; - -Keys :: enum Key { - None :: 0; - Resize :: 0xFF000001; // TODO Using a value incompatible with UTF-8. -} set_next_key :: (key: Key) { input_override = key; @@ -105,6 +104,19 @@ set_next_key :: (key: Key) { get_key :: (timeout_milliseconds: s32 = -1) -> Key { + /* + TODO WIP Implement UTF-8 support, i.e., merge continuation bytes if needed: + + key = arg[0] + while is_last_utf8_byte(buffer[0]) == false { + key = key << 8 + advance(buffer) + key |= buffer[0] + TODO Sometimes we may not have all the necessary bytes in the buffer... and we may need to fetch some more into it. How to do it? + } + advance(arg) + */ + if input_override != xx Keys.None { defer input_override = xx Keys.None; return input_override; |
