summaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-21 20:48:04 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-21 20:48:04 +0200
commitb20b9e14ddd8db111e886ad0494e15b955159426 (patch)
tree81bf23be4dbc17d4b793a29f3252448f5f1e7322 /src/misc1.c
parent4d5c12626c98df23e1a5d953692d946310ddfa9c (diff)
downloadvim-git-b20b9e14ddd8db111e886ad0494e15b955159426.tar.gz
patch 8.1.2062: the mouse code is spread outv8.1.2062
Problem: The mouse code is spread out. Solution: Move all the mouse code to mouse.c. (Yegappan Lakshmanan, closes #4959)
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/src/misc1.c b/src/misc1.c
index e05ad1654..3c0bd4128 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1148,14 +1148,12 @@ ask_yesno(char_u *str, int direct)
settmode(TMODE_RAW);
++no_wait_return;
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
- State = CONFIRM; /* mouse behaves like with :confirm */
-#ifdef FEAT_MOUSE
- setmouse(); /* disables mouse for xterm */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
+ State = CONFIRM; // mouse behaves like with :confirm
+ setmouse(); // disables mouse for xterm
++no_mapping;
- ++allow_keys; /* no mapping here, but recognize keys */
+ ++allow_keys; // no mapping here, but recognize keys
while (r != 'y' && r != 'n')
{
@@ -1172,47 +1170,13 @@ ask_yesno(char_u *str, int direct)
}
--no_wait_return;
State = save_State;
-#ifdef FEAT_MOUSE
setmouse();
-#endif
--no_mapping;
--allow_keys;
return r;
}
-#if defined(FEAT_MOUSE) || defined(PROTO)
-/*
- * Return TRUE if "c" is a mouse key.
- */
- int
-is_mouse_key(int c)
-{
- return c == K_LEFTMOUSE
- || c == K_LEFTMOUSE_NM
- || c == K_LEFTDRAG
- || c == K_LEFTRELEASE
- || c == K_LEFTRELEASE_NM
- || c == K_MOUSEMOVE
- || c == K_MIDDLEMOUSE
- || c == K_MIDDLEDRAG
- || c == K_MIDDLERELEASE
- || c == K_RIGHTMOUSE
- || c == K_RIGHTDRAG
- || c == K_RIGHTRELEASE
- || c == K_MOUSEDOWN
- || c == K_MOUSEUP
- || c == K_MOUSELEFT
- || c == K_MOUSERIGHT
- || c == K_X1MOUSE
- || c == K_X1DRAG
- || c == K_X1RELEASE
- || c == K_X2MOUSE
- || c == K_X2DRAG
- || c == K_X2RELEASE;
-}
-#endif
-
#if defined(FEAT_EVAL) || defined(PROTO)
/*
@@ -1340,6 +1304,8 @@ f_state(typval_T *argvars, typval_T *rettv)
if (channel_in_blocking_wait())
may_add_state_char(&ga, include, 'w');
# endif
+ if (!get_was_safe_state())
+ may_add_state_char(&ga, include, 'S');
for (i = 0; i < get_callback_depth() && i < 3; ++i)
may_add_state_char(&ga, include, 'c');
if (msg_scrolled > 0)
@@ -1572,10 +1538,8 @@ prompt_for_number(int *mouse_used)
cmdline_row = 0;
save_State = State;
State = CMDLINE;
-#ifdef FEAT_MOUSE
// May show different mouse shape.
setmouse();
-#endif
i = get_number(TRUE, mouse_used);
if (KeyTyped)
@@ -1590,10 +1554,8 @@ prompt_for_number(int *mouse_used)
else
cmdline_row = save_cmdline_row;
State = save_State;
-#ifdef FEAT_MOUSE
// May need to restore mouse shape.
setmouse();
-#endif
return i;
}