aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/event.h12
-rw-r--r--src/nvim/os/shell.c5
2 files changed, 15 insertions, 2 deletions
diff --git a/src/nvim/os/event.h b/src/nvim/os/event.h
index f8139e978d..986db51431 100644
--- a/src/nvim/os/event.h
+++ b/src/nvim/os/event.h
@@ -8,9 +8,15 @@
#include "nvim/os/job_defs.h"
#include "nvim/os/time.h"
-// Poll for events until a condition is true or a timeout has passed
+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)) { \
@@ -26,9 +32,13 @@
} \
} \
} \
+ if (timeout < 0 || timeout > 100) { \
+ ui_busy_start(); \
+ } \
} while (0)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/event.h.generated.h"
#endif
+
#endif // NVIM_OS_EVENT_H
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 8cf7e7161d..290d6a9ec9 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -99,7 +99,6 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
char *output = NULL, **output_ptr = NULL;
int current_state = State;
bool forward_output = true;
- ui_flush();
// While the child is running, ignore terminating signals
signal_reject_deadly();
@@ -239,7 +238,11 @@ static int shell(const char *cmd,
job_close_in(job);
}
+ // invoke busy_start here so event_poll_until wont change the busy state for
+ // the UI
+ ui_busy_start();
status = job_wait(job, -1);
+ ui_busy_stop();
// prepare the out parameters if requested
if (output) {