aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-02-13 12:05:57 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-02-16 23:17:38 -0300
commit6383ea6e8e14350432f1fc7da519b54d0ed67f8c (patch)
treed2d675b6b8cefaf9e1ea2bd6916209eef61a74e9 /src/nvim/ui.c
parentd225349dc67a21982308078207786d65518d2c6c (diff)
downloadrneovim-6383ea6e8e14350432f1fc7da519b54d0ed67f8c.tar.gz
rneovim-6383ea6e8e14350432f1fc7da519b54d0ed67f8c.tar.bz2
rneovim-6383ea6e8e14350432f1fc7da519b54d0ed67f8c.zip
ui: Remove redundant cursor_goto calls
Diffstat (limited to 'src/nvim/ui.c')
-rw-r--r--src/nvim/ui.c13
1 files changed, 11 insertions, 2 deletions
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);
+ }
}