diff options
Diffstat (limited to 'TUI/unix.jai')
| -rw-r--r-- | TUI/unix.jai | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/TUI/unix.jai b/TUI/unix.jai index a35c2dc..dd53921 100644 --- a/TUI/unix.jai +++ b/TUI/unix.jai @@ -1,8 +1,8 @@ #scope_file #import "Atomics"; -#import "POSIX"; #import "System"; +#import "POSIX"; // Required to do unlocking input. libc :: #system_library "libc"; @@ -204,7 +204,6 @@ //////////////////////////////////////////////////////////////////////////////// // Resize detection -was_resized : bool; resize_handler :: (signal_code : s32) #c_call { new_context : Context; @@ -232,11 +231,6 @@ restore_resize_handler :: () { #scope_export -OS_flush_input :: inline () { - TCIFLUSH :: 0; // TODO Is this always zero in all systems? - tcflush(STDIN_FILENO, TCIFLUSH); -} - OS_prepare_terminal :: () { tcgetattr(STDIN_FILENO, *initial_tio_mode); // TODO Log error using `log()` from jai/modules/Basic/Print.jai ? raw_tio_mode = initial_tio_mode; @@ -258,6 +252,11 @@ OS_reset_terminal :: () { tcsetattr(STDIN_FILENO, 0, *initial_tio_mode); // TODO Log on error. } +OS_flush_input :: inline () { + TCIFLUSH :: 0; // TODO Is this always zero in all systems? + tcflush(STDIN_FILENO, TCIFLUSH); +} + OS_read_input :: (buffer: *u8, bytes_to_read: s64) -> bytes_read: s64, error: bool = false, error_message: string = "" { bytes_read := read(STDIN_FILENO, buffer, xx bytes_to_read); if bytes_read < 0 { |
