Mercurial > vim
comparison src/misc1.c @ 18135:1868ec23360e v8.1.2062
patch 8.1.2062: the mouse code is spread out
Commit: https://github.com/vim/vim/commit/b20b9e14ddd8db111e886ad0494e15b955159426
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 21 20:48:04 2019 +0200
patch 8.1.2062: the mouse code is spread out
Problem: The mouse code is spread out.
Solution: Move all the mouse code to mouse.c. (Yegappan Lakshmanan,
closes #4959)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 21 Sep 2019 21:00:07 +0200 |
parents | e59ff7b5d7a7 |
children | 2416e1a887ca |
comparison
equal
deleted
inserted
replaced
18134:c06a2bc8144f | 18135:1868ec23360e |
---|---|
1146 | 1146 |
1147 if (exiting) /* put terminal in raw mode for this question */ | 1147 if (exiting) /* put terminal in raw mode for this question */ |
1148 settmode(TMODE_RAW); | 1148 settmode(TMODE_RAW); |
1149 ++no_wait_return; | 1149 ++no_wait_return; |
1150 #ifdef USE_ON_FLY_SCROLL | 1150 #ifdef USE_ON_FLY_SCROLL |
1151 dont_scroll = TRUE; /* disallow scrolling here */ | 1151 dont_scroll = TRUE; // disallow scrolling here |
1152 #endif | 1152 #endif |
1153 State = CONFIRM; /* mouse behaves like with :confirm */ | 1153 State = CONFIRM; // mouse behaves like with :confirm |
1154 #ifdef FEAT_MOUSE | 1154 setmouse(); // disables mouse for xterm |
1155 setmouse(); /* disables mouse for xterm */ | |
1156 #endif | |
1157 ++no_mapping; | 1155 ++no_mapping; |
1158 ++allow_keys; /* no mapping here, but recognize keys */ | 1156 ++allow_keys; // no mapping here, but recognize keys |
1159 | 1157 |
1160 while (r != 'y' && r != 'n') | 1158 while (r != 'y' && r != 'n') |
1161 { | 1159 { |
1162 /* same highlighting as for wait_return */ | 1160 /* same highlighting as for wait_return */ |
1163 smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str); | 1161 smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str); |
1170 msg_putchar(r); /* show what you typed */ | 1168 msg_putchar(r); /* show what you typed */ |
1171 out_flush(); | 1169 out_flush(); |
1172 } | 1170 } |
1173 --no_wait_return; | 1171 --no_wait_return; |
1174 State = save_State; | 1172 State = save_State; |
1175 #ifdef FEAT_MOUSE | |
1176 setmouse(); | 1173 setmouse(); |
1177 #endif | |
1178 --no_mapping; | 1174 --no_mapping; |
1179 --allow_keys; | 1175 --allow_keys; |
1180 | 1176 |
1181 return r; | 1177 return r; |
1182 } | 1178 } |
1183 | |
1184 #if defined(FEAT_MOUSE) || defined(PROTO) | |
1185 /* | |
1186 * Return TRUE if "c" is a mouse key. | |
1187 */ | |
1188 int | |
1189 is_mouse_key(int c) | |
1190 { | |
1191 return c == K_LEFTMOUSE | |
1192 || c == K_LEFTMOUSE_NM | |
1193 || c == K_LEFTDRAG | |
1194 || c == K_LEFTRELEASE | |
1195 || c == K_LEFTRELEASE_NM | |
1196 || c == K_MOUSEMOVE | |
1197 || c == K_MIDDLEMOUSE | |
1198 || c == K_MIDDLEDRAG | |
1199 || c == K_MIDDLERELEASE | |
1200 || c == K_RIGHTMOUSE | |
1201 || c == K_RIGHTDRAG | |
1202 || c == K_RIGHTRELEASE | |
1203 || c == K_MOUSEDOWN | |
1204 || c == K_MOUSEUP | |
1205 || c == K_MOUSELEFT | |
1206 || c == K_MOUSERIGHT | |
1207 || c == K_X1MOUSE | |
1208 || c == K_X1DRAG | |
1209 || c == K_X1RELEASE | |
1210 || c == K_X2MOUSE | |
1211 || c == K_X2DRAG | |
1212 || c == K_X2RELEASE; | |
1213 } | |
1214 #endif | |
1215 | 1179 |
1216 #if defined(FEAT_EVAL) || defined(PROTO) | 1180 #if defined(FEAT_EVAL) || defined(PROTO) |
1217 | 1181 |
1218 /* | 1182 /* |
1219 * "mode()" function | 1183 * "mode()" function |
1338 | 1302 |
1339 # ifdef FEAT_JOB_CHANNEL | 1303 # ifdef FEAT_JOB_CHANNEL |
1340 if (channel_in_blocking_wait()) | 1304 if (channel_in_blocking_wait()) |
1341 may_add_state_char(&ga, include, 'w'); | 1305 may_add_state_char(&ga, include, 'w'); |
1342 # endif | 1306 # endif |
1307 if (!get_was_safe_state()) | |
1308 may_add_state_char(&ga, include, 'S'); | |
1343 for (i = 0; i < get_callback_depth() && i < 3; ++i) | 1309 for (i = 0; i < get_callback_depth() && i < 3; ++i) |
1344 may_add_state_char(&ga, include, 'c'); | 1310 may_add_state_char(&ga, include, 'c'); |
1345 if (msg_scrolled > 0) | 1311 if (msg_scrolled > 0) |
1346 may_add_state_char(&ga, include, 's'); | 1312 may_add_state_char(&ga, include, 's'); |
1347 | 1313 |
1570 // is zero. | 1536 // is zero. |
1571 save_cmdline_row = cmdline_row; | 1537 save_cmdline_row = cmdline_row; |
1572 cmdline_row = 0; | 1538 cmdline_row = 0; |
1573 save_State = State; | 1539 save_State = State; |
1574 State = CMDLINE; | 1540 State = CMDLINE; |
1575 #ifdef FEAT_MOUSE | |
1576 // May show different mouse shape. | 1541 // May show different mouse shape. |
1577 setmouse(); | 1542 setmouse(); |
1578 #endif | |
1579 | 1543 |
1580 i = get_number(TRUE, mouse_used); | 1544 i = get_number(TRUE, mouse_used); |
1581 if (KeyTyped) | 1545 if (KeyTyped) |
1582 { | 1546 { |
1583 // don't call wait_return() now | 1547 // don't call wait_return() now |
1588 msg_didout = FALSE; | 1552 msg_didout = FALSE; |
1589 } | 1553 } |
1590 else | 1554 else |
1591 cmdline_row = save_cmdline_row; | 1555 cmdline_row = save_cmdline_row; |
1592 State = save_State; | 1556 State = save_State; |
1593 #ifdef FEAT_MOUSE | |
1594 // May need to restore mouse shape. | 1557 // May need to restore mouse shape. |
1595 setmouse(); | 1558 setmouse(); |
1596 #endif | |
1597 | 1559 |
1598 return i; | 1560 return i; |
1599 } | 1561 } |
1600 | 1562 |
1601 void | 1563 void |