diff options
| author | dam <devnull@localhost> | 2024-02-09 01:18:03 +0000 |
|---|---|---|
| committer | dam <devnull@localhost> | 2024-02-09 01:18:03 +0000 |
| commit | e8ddaf3289a836c10f45b1b8c019922a99393488 (patch) | |
| tree | e96b77b0764e6ef1fdcf877cc1f7703d7f9e804c /TUI/unix.jai | |
| parent | 0e9f04df9c1804b73baecdf4c3ad14fff977e2f1 (diff) | |
| download | task-time-tracker-e8ddaf3289a836c10f45b1b8c019922a99393488.tar.zst task-time-tracker-e8ddaf3289a836c10f45b1b8c019922a99393488.zip | |
Reimplemented procedure to read input.
Diffstat (limited to 'TUI/unix.jai')
| -rw-r--r-- | TUI/unix.jai | 3 |
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. |
