aboutsummaryrefslogtreecommitdiff
path: root/TUI/unix.jai
diff options
context:
space:
mode:
Diffstat (limited to 'TUI/unix.jai')
-rw-r--r--TUI/unix.jai8
1 files changed, 8 insertions, 0 deletions
diff --git a/TUI/unix.jai b/TUI/unix.jai
index fb79f86..73a763a 100644
--- a/TUI/unix.jai
+++ b/TUI/unix.jai
@@ -25,6 +25,9 @@
// https://codebrowser.dev/glibc/glibc/sysdeps/unix/sysv/linux/tcgetattr.c.html
tcgetattr :: (fd: s32, termios_p: *Terminal_IO_Mode) -> s32 #foreign libc;
+ // https://codebrowser.dev/glibc/glibc/sysdeps/unix/sysv/linux/tcflush.c.html
+ tcflush :: (fd: s32, queue_selector: s32) -> s32 #foreign libc;
+
// Information for the termios.h enums is platform dependent and was retrieved from:
// https://elixir.bootlin.com/glibc/latest/source/sysdeps/unix/sysv/linux/bits/termios.h
@@ -169,6 +172,11 @@ 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 on error.
raw_tio_mode = initial_tio_mode;