Mercurial > vim
comparison src/normal.c @ 18354:9f51d0cef8da v8.1.2171
patch 8.1.2171: mouse support not always available
Commit: https://github.com/vim/vim/commit/a1cb1d1dce14dd005797590721f1bcd0e7c3b35f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 17 23:00:07 2019 +0200
patch 8.1.2171: mouse support not always available
Problem: Mouse support not always available.
Solution: Enable mouse support also in tiny version. Do not define
FEAT_MOUSE_XTERM on MS-Windows (didn't really work).
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 17 Oct 2019 23:15:04 +0200 |
parents | 11f68eb58fda |
children | 34d5cd432cac |
comparison
equal
deleted
inserted
replaced
18353:c3a0f5d3c9d4 | 18354:9f51d0cef8da |
---|---|
301 {'}', nv_findpar, 0, FORWARD}, | 301 {'}', nv_findpar, 0, FORWARD}, |
302 {'~', nv_tilde, 0, 0}, | 302 {'~', nv_tilde, 0, 0}, |
303 | 303 |
304 /* pound sign */ | 304 /* pound sign */ |
305 {POUND, nv_ident, 0, 0}, | 305 {POUND, nv_ident, 0, 0}, |
306 #ifdef FEAT_MOUSE | |
307 {K_MOUSEUP, nv_mousescroll, 0, MSCR_UP}, | 306 {K_MOUSEUP, nv_mousescroll, 0, MSCR_UP}, |
308 {K_MOUSEDOWN, nv_mousescroll, 0, MSCR_DOWN}, | 307 {K_MOUSEDOWN, nv_mousescroll, 0, MSCR_DOWN}, |
309 {K_MOUSELEFT, nv_mousescroll, 0, MSCR_LEFT}, | 308 {K_MOUSELEFT, nv_mousescroll, 0, MSCR_LEFT}, |
310 {K_MOUSERIGHT, nv_mousescroll, 0, MSCR_RIGHT}, | 309 {K_MOUSERIGHT, nv_mousescroll, 0, MSCR_RIGHT}, |
311 {K_LEFTMOUSE, nv_mouse, 0, 0}, | 310 {K_LEFTMOUSE, nv_mouse, 0, 0}, |
324 {K_X1DRAG, nv_mouse, 0, 0}, | 323 {K_X1DRAG, nv_mouse, 0, 0}, |
325 {K_X1RELEASE, nv_mouse, 0, 0}, | 324 {K_X1RELEASE, nv_mouse, 0, 0}, |
326 {K_X2MOUSE, nv_mouse, 0, 0}, | 325 {K_X2MOUSE, nv_mouse, 0, 0}, |
327 {K_X2DRAG, nv_mouse, 0, 0}, | 326 {K_X2DRAG, nv_mouse, 0, 0}, |
328 {K_X2RELEASE, nv_mouse, 0, 0}, | 327 {K_X2RELEASE, nv_mouse, 0, 0}, |
329 #endif | |
330 {K_IGNORE, nv_ignore, NV_KEEPREG, 0}, | 328 {K_IGNORE, nv_ignore, NV_KEEPREG, 0}, |
331 {K_NOP, nv_nop, 0, 0}, | 329 {K_NOP, nv_nop, 0, 0}, |
332 {K_INS, nv_edit, 0, 0}, | 330 {K_INS, nv_edit, 0, 0}, |
333 {K_KINS, nv_edit, 0, 0}, | 331 {K_KINS, nv_edit, 0, 0}, |
334 {K_BS, nv_ctrlh, 0, 0}, | 332 {K_BS, nv_ctrlh, 0, 0}, |
1317 if (clip_star.available && clip_star.owned) | 1315 if (clip_star.available && clip_star.owned) |
1318 clip_auto_select(); | 1316 clip_auto_select(); |
1319 #endif | 1317 #endif |
1320 | 1318 |
1321 VIsual_active = FALSE; | 1319 VIsual_active = FALSE; |
1322 #ifdef FEAT_MOUSE | |
1323 setmouse(); | 1320 setmouse(); |
1324 mouse_dragging = 0; | 1321 mouse_dragging = 0; |
1325 #endif | |
1326 | 1322 |
1327 /* Save the current VIsual area for '< and '> marks, and "gv" */ | 1323 /* Save the current VIsual area for '< and '> marks, and "gv" */ |
1328 curbuf->b_visual.vi_mode = VIsual_mode; | 1324 curbuf->b_visual.vi_mode = VIsual_mode; |
1329 curbuf->b_visual.vi_start = VIsual; | 1325 curbuf->b_visual.vi_start = VIsual; |
1330 curbuf->b_visual.vi_end = curwin->w_cursor; | 1326 curbuf->b_visual.vi_end = curwin->w_cursor; |
1847 { | 1843 { |
1848 char_u *p; | 1844 char_u *p; |
1849 int old_len; | 1845 int old_len; |
1850 int extra_len; | 1846 int extra_len; |
1851 int overflow; | 1847 int overflow; |
1852 #if defined(FEAT_MOUSE) | |
1853 int i; | 1848 int i; |
1854 static int ignore[] = | 1849 static int ignore[] = |
1855 { | 1850 { |
1856 # ifdef FEAT_GUI | 1851 #ifdef FEAT_GUI |
1857 K_VER_SCROLLBAR, K_HOR_SCROLLBAR, | 1852 K_VER_SCROLLBAR, K_HOR_SCROLLBAR, |
1858 K_LEFTMOUSE_NM, K_LEFTRELEASE_NM, | 1853 K_LEFTMOUSE_NM, K_LEFTRELEASE_NM, |
1859 # endif | 1854 #endif |
1860 K_IGNORE, K_PS, | 1855 K_IGNORE, K_PS, |
1861 K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE, | 1856 K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE, |
1862 K_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE, | 1857 K_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE, |
1863 K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE, | 1858 K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE, |
1864 K_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT, | 1859 K_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT, |
1865 K_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE, | 1860 K_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE, |
1866 K_CURSORHOLD, | 1861 K_CURSORHOLD, |
1867 0 | 1862 0 |
1868 }; | 1863 }; |
1869 #endif | |
1870 | 1864 |
1871 if (!p_sc || msg_silent != 0) | 1865 if (!p_sc || msg_silent != 0) |
1872 return FALSE; | 1866 return FALSE; |
1873 | 1867 |
1874 if (showcmd_visual) | 1868 if (showcmd_visual) |
1875 { | 1869 { |
1876 showcmd_buf[0] = NUL; | 1870 showcmd_buf[0] = NUL; |
1877 showcmd_visual = FALSE; | 1871 showcmd_visual = FALSE; |
1878 } | 1872 } |
1879 | 1873 |
1880 #if defined(FEAT_MOUSE) | |
1881 /* Ignore keys that are scrollbar updates and mouse clicks */ | 1874 /* Ignore keys that are scrollbar updates and mouse clicks */ |
1882 if (IS_SPECIAL(c)) | 1875 if (IS_SPECIAL(c)) |
1883 for (i = 0; ignore[i] != 0; ++i) | 1876 for (i = 0; ignore[i] != 0; ++i) |
1884 if (ignore[i] == c) | 1877 if (ignore[i] == c) |
1885 return FALSE; | 1878 return FALSE; |
1886 #endif | |
1887 | 1879 |
1888 p = transchar(c); | 1880 p = transchar(c); |
1889 if (*p == ' ') | 1881 if (*p == ' ') |
1890 STRCPY(p, "<20>"); | 1882 STRCPY(p, "<20>"); |
1891 old_len = (int)STRLEN(showcmd_buf); | 1883 old_len = (int)STRLEN(showcmd_buf); |
4623 if (pos == NULL) | 4615 if (pos == NULL) |
4624 pos = &prev_pos; | 4616 pos = &prev_pos; |
4625 nv_cursormark(cap, cap->nchar == '\'', pos); | 4617 nv_cursormark(cap, cap->nchar == '\'', pos); |
4626 } | 4618 } |
4627 | 4619 |
4628 #ifdef FEAT_MOUSE | |
4629 /* | 4620 /* |
4630 * [ or ] followed by a middle mouse click: put selected text with | 4621 * [ or ] followed by a middle mouse click: put selected text with |
4631 * indent adjustment. Any other button just does as usual. | 4622 * indent adjustment. Any other button just does as usual. |
4632 */ | 4623 */ |
4633 else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE) | 4624 else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE) |
4634 { | 4625 { |
4635 (void)do_mouse(cap->oap, cap->nchar, | 4626 (void)do_mouse(cap->oap, cap->nchar, |
4636 (cap->cmdchar == ']') ? FORWARD : BACKWARD, | 4627 (cap->cmdchar == ']') ? FORWARD : BACKWARD, |
4637 cap->count1, PUT_FIXINDENT); | 4628 cap->count1, PUT_FIXINDENT); |
4638 } | 4629 } |
4639 #endif /* FEAT_MOUSE */ | |
4640 | 4630 |
4641 #ifdef FEAT_FOLDING | 4631 #ifdef FEAT_FOLDING |
4642 /* | 4632 /* |
4643 * "[z" and "]z": move to start or end of open fold. | 4633 * "[z" and "]z": move to start or end of open fold. |
4644 */ | 4634 */ |
6218 case 'd': | 6208 case 'd': |
6219 case 'D': | 6209 case 'D': |
6220 nv_gd(oap, cap->nchar, (int)cap->count0); | 6210 nv_gd(oap, cap->nchar, (int)cap->count0); |
6221 break; | 6211 break; |
6222 | 6212 |
6223 #ifdef FEAT_MOUSE | |
6224 /* | 6213 /* |
6225 * g<*Mouse> : <C-*mouse> | 6214 * g<*Mouse> : <C-*mouse> |
6226 */ | 6215 */ |
6227 case K_MIDDLEMOUSE: | 6216 case K_MIDDLEMOUSE: |
6228 case K_MIDDLEDRAG: | 6217 case K_MIDDLEDRAG: |
6241 case K_X2DRAG: | 6230 case K_X2DRAG: |
6242 case K_X2RELEASE: | 6231 case K_X2RELEASE: |
6243 mod_mask = MOD_MASK_CTRL; | 6232 mod_mask = MOD_MASK_CTRL; |
6244 (void)do_mouse(oap, cap->nchar, BACKWARD, cap->count1, 0); | 6233 (void)do_mouse(oap, cap->nchar, BACKWARD, cap->count1, 0); |
6245 break; | 6234 break; |
6246 #endif | |
6247 | 6235 |
6248 case K_IGNORE: | 6236 case K_IGNORE: |
6249 break; | 6237 break; |
6250 | 6238 |
6251 /* | 6239 /* |