aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-03-18 22:42:19 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-03-18 22:42:19 -0300
commit608d709fa0878cbc4ff7386badc81fdfcc66234a (patch)
treefc861fa278e095a38d4b39bb9ac736321446b6da /src/nvim/os
parenta0f2961b4fc2beabf1266faef0f543afdffd45f8 (diff)
parent4d63d9917482a7d7a002bf7688233a675b76cd3e (diff)
downloadrneovim-608d709fa0878cbc4ff7386badc81fdfcc66234a.tar.gz
rneovim-608d709fa0878cbc4ff7386badc81fdfcc66234a.tar.bz2
rneovim-608d709fa0878cbc4ff7386badc81fdfcc66234a.zip
Merge PR #2182 'Improve ui/busy handling and early input reading'
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/event.h9
-rw-r--r--src/nvim/os/input.c6
-rw-r--r--src/nvim/os/shell.c1
3 files changed, 4 insertions, 12 deletions
diff --git a/src/nvim/os/event.h b/src/nvim/os/event.h
index 986db51431..db02b38c7f 100644
--- a/src/nvim/os/event.h
+++ b/src/nvim/os/event.h
@@ -8,15 +8,9 @@
#include "nvim/os/job_defs.h"
#include "nvim/os/time.h"
-void ui_busy_start(void);
-void ui_busy_stop(void);
-
// Poll for events until a condition or timeout
#define event_poll_until(timeout, condition) \
do { \
- if (timeout < 0 || timeout > 100) { \
- ui_busy_stop(); \
- } \
int remaining = timeout; \
uint64_t before = (remaining > 0) ? os_hrtime() : 0; \
while (!(condition)) { \
@@ -32,9 +26,6 @@ void ui_busy_stop(void);
} \
} \
} \
- if (timeout < 0 || timeout > 100) { \
- ui_busy_start(); \
- } \
} while (0)
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 00efa28161..a409a9ed13 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -46,7 +46,7 @@ void input_init(void)
input_buffer = rbuffer_new(INPUT_BUFFER_SIZE + MAX_KEY_CODE_LEN);
}
-void input_start_stdin(void)
+void input_start_stdin(int fd)
{
if (read_stream) {
return;
@@ -54,7 +54,7 @@ void input_start_stdin(void)
read_buffer = rbuffer_new(READ_BUFFER_SIZE);
read_stream = rstream_new(read_cb, read_buffer, NULL);
- rstream_set_file(read_stream, fileno(stdin));
+ rstream_set_file(read_stream, fd);
rstream_start(read_stream);
}
@@ -69,7 +69,7 @@ void input_stop_stdin(void)
read_stream = NULL;
}
-// Low level input function.
+// Low level input function
int os_inchar(uint8_t *buf, int maxlen, int ms, int tb_change_cnt)
{
if (rbuffer_pending(input_buffer)) {
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 290d6a9ec9..6fcb62a5f3 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -241,6 +241,7 @@ static int shell(const char *cmd,
// invoke busy_start here so event_poll_until wont change the busy state for
// the UI
ui_busy_start();
+ ui_flush();
status = job_wait(job, -1);
ui_busy_stop();