From 8b7b71f4742d94cf7a2e5a08e7b2f5a725619476 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Wed, 18 Mar 2015 12:34:36 -0300 Subject: ui: Refactor so that busy state won't be the default Even though assuming nvim is busy most times is simpler, it has a problem: A lot of unnecessary busy_start/busy_stop notifications are sent to the UI. That's because in the majority of scenarios almost no time is spent between `event_poll` calls. This restores the normal behavior which is to call busy_start only when nvim is going to perform some task that can take a significant amount of time. Also improve the usage of buffering in the TUI when changing the cursor state. --- src/nvim/os/event.h | 9 --------- src/nvim/os/shell.c | 1 + 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'src/nvim/os') 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/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(); -- cgit