aboutsummaryrefslogtreecommitdiff
path: root/TUI/module.jai
diff options
context:
space:
mode:
authordam <devnull@localhost>2024-02-16 02:33:20 +0000
committerdam <devnull@localhost>2024-02-16 02:33:20 +0000
commitcbb4b1f06b2395705851430742e23240ece90510 (patch)
treeb8ca6b4a657db467768147fe1c32ce07c85a1bc3 /TUI/module.jai
parentb3c9a89d19a3021f56a8d9249307a0c38ee5cfd6 (diff)
downloadtask-time-tracker-cbb4b1f06b2395705851430742e23240ece90510.tar.zst
task-time-tracker-cbb4b1f06b2395705851430742e23240ece90510.zip
Base implementation of TUI/windows.
Diffstat (limited to 'TUI/module.jai')
-rw-r--r--TUI/module.jai10
1 files changed, 4 insertions, 6 deletions
diff --git a/TUI/module.jai b/TUI/module.jai
index 0ae0398..9c90805 100644
--- a/TUI/module.jai
+++ b/TUI/module.jai
@@ -157,14 +157,13 @@ set_style :: (bold: bool, underline: bool = false, strike_through: bool = false,
key/u64 |0|0|c|b|a| -> that in memory lays as (BE:|0|0|c|b|a|) and (LE:|a|b|c|0|0|)
*/
-Key :: u64;
+Key :: u64; // Terminal key-codes have 1 to 6 bytes so we'll use 8 bytes.
KEY_SIZE :: #run type_info(Key).runtime_size;
Keys :: struct #type_info_none {
- // Terminal key-codes have 1 to 6 bytes, so we can signal special cases setting the edge-bytes.
- None : Key : 0xF0000000_0000000F;
- Resize : Key : 0xF0000000_0000001F;
+ None : Key : #run to_key("#NONE");
+ Resize : Key : #run to_key("#RESIZE");
Space : Key : #char " ";
Enter : Key : #char "\r";
@@ -399,7 +398,6 @@ set_next_key :: (key: Key) {
get_key :: (timeout_milliseconds: s32 = -1) -> Key {
assert_is_initialized();
-
/*
TODO
get_key already deals with utf8 codes, but we don't know when we're receiving ANSI escape codes. If initial key is escape and other keys are awaiting in the input buffer, we need to parse them as escaped sequences. See wikiedia* for help on that. Lets use the escape sequences used on windows amd forget all others. Those should be the most used ones; at least they are the cross-platform compatible ones :P
@@ -429,7 +427,7 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key {
defer input_override = xx Keys.None;
return input_override;
}
-
+
if OS_was_terminal_resized() return xx Keys.Resize;
should_read_input := false;