From 6383ea6e8e14350432f1fc7da519b54d0ed67f8c Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 13 Feb 2015 12:05:57 -0300 Subject: ui: Remove redundant cursor_goto calls --- src/nvim/ui.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/ui.c b/src/nvim/ui.c index a8ca58d633..80204d6bba 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -60,7 +60,7 @@ static struct { int top, bot, left, right; } sr; static int current_highlight_mask = 0; -static bool cursor_enabled = true; +static bool cursor_enabled = true, pending_cursor_update = false; static int height, width; // This set of macros allow us to use UI_CALL to invoke any function on @@ -71,6 +71,7 @@ static int height, width; // works. #define UI_CALL(...) \ do { \ + flush_cursor_update(); \ for (size_t i = 0; i < ui_count; i++) { \ UI *ui = uis[i]; \ UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \ @@ -558,5 +559,13 @@ static void ui_cursor_goto(int new_row, int new_col) } row = new_row; col = new_col; - UI_CALL(cursor_goto, row, col); + pending_cursor_update = true; +} + +static void flush_cursor_update(void) +{ + if (pending_cursor_update) { + pending_cursor_update = false; + UI_CALL(cursor_goto, row, col); + } } -- cgit