From 90d17cde7d92be5e2c1bedb97c8c8d5ca324a39d Mon Sep 17 00:00:00 2001 From: dam Date: Tue, 30 Apr 2024 18:32:28 +0100 Subject: Removed some 'inline' marks, and added some TODO entries. --- modules/TUI/module.jai | 5 +++-- modules/TUI/unix.jai | 6 +++--- modules/TUI/windows.jai | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai index 121aa42..f8b8265 100644 --- a/modules/TUI/module.jai +++ b/modules/TUI/module.jai @@ -381,7 +381,7 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key { read_input :: (count_limit: int = -1, terminators: .. u8) -> string { assert_is_active(); - assert(count_limit >= 0 || terminators.count > 0, "Infinite loop detected, aborting."); // TODO Maybe just return!? + assert(count_limit >= 0 || terminators.count > 0, "Infinite loop detected, aborting."); // TODO Maybe just return!? Or simply return success=false with #must if count_limit < 0 { builder: String_Builder; @@ -438,7 +438,7 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { Resize discards the input returning an empty string and a Resize key. */ - assert(count_limit >= 0, "Invalid value on count_limit parameter."); + assert(count_limit >= 0, "Invalid value on count_limit parameter."); // TODO Too agressive str := alloc_string(count_limit); str.count = 0; @@ -446,6 +446,7 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { // TODO Some of these may be nice to have: // > https://unix.stackexchange.com/questions/255707/what-are-the-keyboard-shortcuts-for-the-command-line + // At least... add the Ctrl+u to clear the entire line. x, y := get_cursor_position(); write_strings(Commands.ShowCursor, Commands.StartBlinking, Commands.BlinkingBarShape); diff --git a/modules/TUI/unix.jai b/modules/TUI/unix.jai index e1c0b3a..a8e0edf 100644 --- a/modules/TUI/unix.jai +++ b/modules/TUI/unix.jai @@ -263,7 +263,7 @@ OS_prepare_terminal :: () -> success := true { return; } -OS_reset_terminal :: inline () -> success := true { +OS_reset_terminal :: () -> success := true { restore_resize_handler(); error := tcsetattr(STDIN_FILENO, xx Optional_Actions.TCSANOW, *initial_tio_mode); if error { @@ -274,7 +274,7 @@ OS_reset_terminal :: inline () -> success := true { return; } -OS_flush_input :: inline () -> success := true { +OS_flush_input :: () -> success := true { error := tcflush(STDIN_FILENO, xx Queue_Selector.TCIFLUSH); if error { error_code, error_string := get_error_value_and_string(); @@ -314,6 +314,6 @@ OS_wait_for_input :: (timeout_milliseconds: s32 = -1) -> is_input_available: boo return ifx result > 0 then true else false; } -OS_was_terminal_resized :: () -> bool { +OS_was_terminal_resized :: inline () -> bool { return atomic_swap(*was_resized, false); } diff --git a/modules/TUI/windows.jai b/modules/TUI/windows.jai index 608266d..fb50e49 100644 --- a/modules/TUI/windows.jai +++ b/modules/TUI/windows.jai @@ -137,7 +137,7 @@ //////////////////////////////////////////////////////////////////////////////// -peek_input :: inline () -> INPUT_RECORD, success := true { +peek_input :: () -> INPUT_RECORD, success := true { record: INPUT_RECORD; records_read: u32; if PeekConsoleInputW(stdin, *record, 1, *records_read) == false { @@ -148,7 +148,7 @@ peek_input :: inline () -> INPUT_RECORD, success := true { return record; } -read_input :: inline () -> INPUT_RECORD, success := true { +read_input :: () -> INPUT_RECORD, success := true { record: INPUT_RECORD; records_read: u32; if ReadConsoleInputW(stdin, *record, 1, *records_read) == false { @@ -159,7 +159,7 @@ read_input :: inline () -> INPUT_RECORD, success := true { return record; } -count_input :: inline () -> u32, success := true { +count_input :: () -> u32, success := true { count: u32; if GetNumberOfConsoleInputEvents(stdin, *count) == false { error_code, error_string := get_error_value_and_string(); @@ -242,7 +242,7 @@ OS_reset_terminal :: () -> success := true { return; } -OS_flush_input :: inline () { +OS_flush_input :: () { // This API is not recommended and does not have a virtual terminal equivalent. // Attempting to empty the input queue all at once can destroy state in the queue in an unexpected manner. if FlushConsoleInputBuffer(stdin) == false { @@ -379,7 +379,7 @@ OS_wait_for_input :: (timeout_milliseconds: s32 = -1) -> is_input_available: boo return false; } -OS_was_terminal_resized :: () -> bool { +OS_was_terminal_resized :: inline () -> bool { while peek_input().EventType == .WINDOW_BUFFER_SIZE_EVENT { was_resized = true; read_input(); -- cgit v1.2.3