aboutsummaryrefslogtreecommitdiff
path: root/TUI/unix.jai
diff options
context:
space:
mode:
Diffstat (limited to 'TUI/unix.jai')
-rw-r--r--TUI/unix.jai3
1 files changed, 2 insertions, 1 deletions
diff --git a/TUI/unix.jai b/TUI/unix.jai
index 7a25b6b..2da4437 100644
--- a/TUI/unix.jai
+++ b/TUI/unix.jai
@@ -257,6 +257,7 @@ OS_flush_input :: inline () {
tcflush(STDIN_FILENO, TCIFLUSH);
}
+// TODO Nothing is checking for the errors returned by this... shame!
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 {
@@ -269,7 +270,7 @@ OS_read_input :: (buffer: *u8, bytes_to_read: s64) -> bytes_read: s64, error: bo
// timeout_milliseconds
// 0: do not wait
// -1: wait indefinitely
-OS_wait_for_input :: (timeout_milliseconds: s32) -> is_input_available: bool {
+OS_wait_for_input :: (timeout_milliseconds: s32 = -1) -> is_input_available: bool {
fds := pollfd.[ .{ fd = STDIN_FILENO, events = POLLIN, revents = 0 } ];
nfds := fds.count;
poll_return := poll(fds.data, xx nfds, xx timeout_milliseconds); // TODO Wait for input using poll syscall. This breaks and throws '-1 | 4 | Interrupted system call' when we resize the window while polling.