aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-12-02 07:51:18 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-12-02 07:51:18 -0300
commit888511862bc7b0850e2695e3edd46212dc78cc47 (patch)
tree572598e6b335008a71d6bc76faf6c5be7185d91c /src/nvim/os
parent212cb13ca4526350ce761378505536fafb559eab (diff)
parent6436908ffe1906804a13073dd474e109e8be1d91 (diff)
downloadrneovim-888511862bc7b0850e2695e3edd46212dc78cc47.tar.gz
rneovim-888511862bc7b0850e2695e3edd46212dc78cc47.tar.bz2
rneovim-888511862bc7b0850e2695e3edd46212dc78cc47.zip
Merge PR #1591 'Prepare to rewrite the terminal UI'
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/shell.c10
-rw-r--r--src/nvim/os/time.c30
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()