From 502aee690c980fcb3cfcb3f211dcfad06103db46 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 7 Aug 2015 22:54:02 -0300 Subject: event: Refactor async event processing - Improve the implementation of deferred/immediate events. - Use the new queue module to change how/when events are queued/processed by giving a private queue to each emitter. - Immediate events(which only exist to break uv_run recursion) are now represented in the `loop->fast_events` queue. - Events pushed to child queues are propagated to the event loop main queue and processed as K_EVENT keys. --- src/nvim/ui.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/nvim/ui.c') diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 7e155f9b4f..ad875367c9 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -214,9 +214,9 @@ void ui_detach(UI *ui) shift_index++; } - ui_count--; - // schedule a refresh - loop_push_event(&loop, (Event) { .handler = refresh }, false); + if (--ui_count) { + ui_refresh(); + } } void ui_clear(void) @@ -485,11 +485,3 @@ static void ui_mode_change(void) UI_CALL(mode_change, mode); conceal_check_cursur_line(); } - -static void refresh(Event event) -{ - if (ui_count) { - ui_refresh(); - } -} - -- cgit