aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mouse.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-01-01 20:04:09 +0100
committerGitHub <noreply@github.com>2021-01-01 20:04:09 +0100
commit90f619f140f0736f67fef796d58203fe261c43af (patch)
treeb6ee6639b7ac844a6aa18104591902cf416908ab /src/nvim/mouse.c
parentf3a8c930a4b901c5313701849e7010f098bf22e6 (diff)
parent6db86cb2d3d4ca152f156dc07362f8796150fae0 (diff)
downloadrneovim-90f619f140f0736f67fef796d58203fe261c43af.tar.gz
rneovim-90f619f140f0736f67fef796d58203fe261c43af.tar.bz2
rneovim-90f619f140f0736f67fef796d58203fe261c43af.zip
Merge pull request #13592 from bfredl/setmouse
ui: make 'mouse' handling in external UI more consistent
Diffstat (limited to 'src/nvim/mouse.c')
-rw-r--r--src/nvim/mouse.c46
1 files changed, 1 insertions, 45 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index f05dade73f..ff471ea978 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -526,53 +526,9 @@ static win_T *mouse_find_grid_win(int *gridp, int *rowp, int *colp)
void setmouse(void)
{
ui_cursor_shape();
-
- // Be quick when mouse is off.
- if (*p_mouse == NUL) {
- return;
- }
-
- int checkfor = MOUSE_NORMAL; // assume normal mode
- if (VIsual_active) {
- checkfor = MOUSE_VISUAL;
- } else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE) {
- checkfor = MOUSE_RETURN;
- } else if (State & INSERT) {
- checkfor = MOUSE_INSERT;
- } else if (State & CMDLINE) {
- checkfor = MOUSE_COMMAND;
- } else if (State == CONFIRM || State == EXTERNCMD) {
- checkfor = ' '; // don't use mouse for ":confirm" or ":!cmd"
- }
-
- if (mouse_has(checkfor)) {
- ui_call_mouse_on();
- } else {
- ui_call_mouse_off();
- }
+ ui_check_mouse();
}
-/*
- * Return true if
- * - "c" is in 'mouse', or
- * - 'a' is in 'mouse' and "c" is in MOUSE_A, or
- * - the current buffer is a help file and 'h' is in 'mouse' and we are in a
- * normal editing mode (not at hit-return message).
- */
-int mouse_has(int c)
-{
- for (char_u *p = p_mouse; *p; ++p)
- switch (*p) {
- case 'a': if (vim_strchr((char_u *)MOUSE_A, c) != NULL)
- return true;
- break;
- case MOUSE_HELP: if (c != MOUSE_RETURN && curbuf->b_help)
- return true;
- break;
- default: if (c == *p) return true; break;
- }
- return false;
-}
// Set orig_topline. Used when jumping to another window, so that a double
// click still works.