aboutsummaryrefslogtreecommitdiff
path: root/modules/TUI/module.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2024-03-24 00:50:01 +0000
committerdam <dam@gudinoff>2024-03-24 00:50:01 +0000
commitf1fe4f6bcf27e0843d424f4885b0913e220ade2e (patch)
treec4fc93f547d333a247f918f571fa07e8b7862dc9 /modules/TUI/module.jai
parentb47287aaa3cfa384ec683ff58e0d247e8bad32b1 (diff)
downloadtask-time-tracker-f1fe4f6bcf27e0843d424f4885b0913e220ade2e.tar.zst
task-time-tracker-f1fe4f6bcf27e0843d424f4885b0913e220ade2e.zip
Improved robustness and code clarity on get_key.
Diffstat (limited to 'modules/TUI/module.jai')
-rw-r--r--modules/TUI/module.jai8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai
index 93e410e..6aeac68 100644
--- a/modules/TUI/module.jai
+++ b/modules/TUI/module.jai
@@ -332,11 +332,13 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key {
key, success = table_find(*key_map, to_parse);
}
- // If an escape code was found, use it.
+
if success {
- return key;
+ return key; // Escape code found, return it.
+ }
+ else {
+ to_parse.count = 1; // No escape code found, return a single (escape) character.
}
- // else { ... } If we entered this block and did not succeed, then we'll return a single escape character.รข
}
return to_key(to_parse);