aboutsummaryrefslogtreecommitdiff
path: root/modules/TUI/module.jai
diff options
context:
space:
mode:
Diffstat (limited to 'modules/TUI/module.jai')
-rw-r--r--modules/TUI/module.jai23
1 files changed, 8 insertions, 15 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai
index 2d23bff..7c9d7b1 100644
--- a/modules/TUI/module.jai
+++ b/modules/TUI/module.jai
@@ -267,21 +267,22 @@ Keys :: struct #type_info_none {
active := false;
-//input_buffer : [64] u8; // TODO FIXME Input buffer is too small!!!
-input_buffer : [8] u8; // TODO FIXME Input buffer is too small!!!
+input_buffer : [1024] u8;
input_string : string;
input_override : Key;
#run {
- // TODO FIXME DEBUG HACK or maybe... let it be?!
- // Some tests.
- assert(input_buffer.count >= KEY_SIZE, "The input buffer size must be capable to hold an entire terminal (6 bytes) or UTF8 (4 bytes) code.");
+ assert(input_buffer.count >= KEY_SIZE, "The input buffer size must be capable to hold an entire Key, which should be able to hold an UTF8 code (4 bytes) or a terminal escape code (6 bytes).");
}
assert_is_active :: inline () {
assert(active, "TUI is not ready.");
}
+////////////////////////////////////////////////////////////////////////////////
+
+// #scope_export TODO Setup the scope_export and scope_file
+
set_next_key :: (key: Key) {
assert_is_active();
input_override = key;
@@ -295,7 +296,7 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key {
return input_override;
}
- if OS_was_terminal_resized() return xx Keys.Resize;
+ if OS_was_terminal_resized() return Keys.Resize;
should_read_input := false;
is_input_available := false;
@@ -309,7 +310,7 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key {
is_input_available = OS_wait_for_input(0);
}
- if OS_was_terminal_resized() return xx Keys.Resize;
+ if OS_was_terminal_resized() return Keys.Resize;
if should_read_input && is_input_available {
// Copy buffered bytes to the start, and read the remaining ones from input.
@@ -687,11 +688,3 @@ set_terminal_title :: (title: string) {
assert_is_active();
print(Commands.SetWindowTitle, title);
}
-
-// TODO
-#if OS == .WINDOWS {
- // Prototyping zone... keep clear!
-}
-else #if OS == .LINUX || OS == .MACOS {
- // Prototyping zone... keep clear!
-}