diff options
author | James McCoy <jamessan@jamessan.com> | 2017-04-01 18:00:42 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-04-02 00:00:42 +0200 |
commit | 16babc66870b5579f3305fa1289f25e1dc496655 (patch) | |
tree | b22a297ae780e7632115673fbf7e92381906e48a | |
parent | 518f28f537971c70d7781ce30c5de0c829e01464 (diff) | |
download | rneovim-16babc66870b5579f3305fa1289f25e1dc496655.tar.gz rneovim-16babc66870b5579f3305fa1289f25e1dc496655.tar.bz2 rneovim-16babc66870b5579f3305fa1289f25e1dc496655.zip |
tui: Only enable/disable mouse when there's something to do (#6411)
If we get a mouse_on/mouse_off event, but the mouse is already in the
corresponding state, there's no need to send the event up to the
terminal.
Closes #4394
-rw-r--r-- | src/nvim/tui/tui.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 55936ad58d..ebdfb1e7a1 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -452,15 +452,19 @@ static void tui_busy_stop(UI *ui) static void tui_mouse_on(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, data->unibi_ext.enable_mouse); - data->mouse_enabled = true; + if (!data->mouse_enabled) { + unibi_out(ui, data->unibi_ext.enable_mouse); + data->mouse_enabled = true; + } } static void tui_mouse_off(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, data->unibi_ext.disable_mouse); - data->mouse_enabled = false; + if (data->mouse_enabled) { + unibi_out(ui, data->unibi_ext.disable_mouse); + data->mouse_enabled = false; + } } static void tui_mode_change(UI *ui, int mode) |