diff options
Diffstat (limited to 'src/nvim/mouse.c')
-rw-r--r-- | src/nvim/mouse.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index d0aa0653cb..deb7ee6342 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -508,31 +508,30 @@ static win_T *mouse_find_grid_win(int *gridp, int *rowp, int *colp) return NULL; } -/* - * setmouse() - switch mouse on/off depending on current mode and 'mouse' - */ +/// Set UI mouse depending on current mode and 'mouse'. +/// +/// Emits mouse_on/mouse_off UI event (unless 'mouse' is empty). void setmouse(void) { - int checkfor; - ui_cursor_shape(); - /* be quick when mouse is off */ - if (*p_mouse == NUL) + // Be quick when mouse is off. + if (*p_mouse == NUL) { return; + } - if (VIsual_active) + int checkfor = MOUSE_NORMAL; // assume normal mode + if (VIsual_active) { checkfor = MOUSE_VISUAL; - else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE) + } else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE) { checkfor = MOUSE_RETURN; - else if (State & INSERT) + } else if (State & INSERT) { checkfor = MOUSE_INSERT; - else if (State & CMDLINE) + } else if (State & CMDLINE) { checkfor = MOUSE_COMMAND; - else if (State == CONFIRM || State == EXTERNCMD) - checkfor = ' '; /* don't use mouse for ":confirm" or ":!cmd" */ - else - checkfor = MOUSE_NORMAL; /* assume normal mode */ + } else if (State == CONFIRM || State == EXTERNCMD) { + checkfor = ' '; // don't use mouse for ":confirm" or ":!cmd" + } if (mouse_has(checkfor)) { ui_call_mouse_on(); |