From cbb4b1f06b2395705851430742e23240ece90510 Mon Sep 17 00:00:00 2001 From: dam Date: Fri, 16 Feb 2024 02:33:20 +0000 Subject: Base implementation of TUI/windows. --- TUI/module.jai | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'TUI/module.jai') 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; -- cgit v1.2.3