diff options
Diffstat (limited to 'src/nvim/os')
| -rw-r--r-- | src/nvim/os/shell.c | 10 | ||||
| -rw-r--r-- | src/nvim/os/time.c | 30 |
2 files changed, 12 insertions, 28 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 1b279f18f5..cdd85e4e96 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -104,14 +104,10 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_arg) { DynamicBuffer input = DYNAMIC_BUFFER_INIT; char *output = NULL, **output_ptr = NULL; - int current_state = State, old_mode = cur_tmode; + int current_state = State; bool forward_output = true; out_flush(); - if (opts & kShellOptCooked) { - settmode(TMODE_COOK); - } - // While the child is running, ignore terminating signals signal_reject_deadly(); @@ -155,10 +151,6 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_arg) msg_putchar('\n'); } - if (old_mode == TMODE_RAW) { - // restore mode - settmode(TMODE_RAW); - } State = current_state; signal_accept_deadly(); diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index a4871ef499..3794e813d2 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -6,6 +6,7 @@ #include <uv.h> #include "nvim/os/time.h" +#include "nvim/os/event.h" #include "nvim/vim.h" #include "nvim/term.h" @@ -38,31 +39,22 @@ uint64_t os_hrtime(void) /// @param ignoreinput If true, allow a SIGINT to interrupt us void os_delay(uint64_t milliseconds, bool ignoreinput) { - os_microdelay(milliseconds * 1000, ignoreinput); + if (ignoreinput) { + if (milliseconds > INT_MAX) { + milliseconds = INT_MAX; + } + event_poll_until((int)milliseconds, got_int); + } else { + os_microdelay(milliseconds * 1000); + } } /// Sleeps for a certain amount of microseconds /// /// @param microseconds Number of microseconds to sleep -/// @param ignoreinput If true, allow a SIGINT to interrupt us -void os_microdelay(uint64_t microseconds, bool ignoreinput) +void os_microdelay(uint64_t microseconds) { - int old_tmode; - - if (ignoreinput) { - // Go to cooked mode without echo, to allow SIGINT interrupting us - // here - old_tmode = curr_tmode; - - if (curr_tmode == TMODE_RAW) - settmode(TMODE_SLEEP); - - microdelay(microseconds); - - settmode(old_tmode); - } else { - microdelay(microseconds); - } + microdelay(microseconds); } /// Portable version of POSIX localtime_r() |