diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-03-16 14:20:51 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-03-16 14:20:51 +0100 |
commit | 2526ef276b97b1a5275fc0039fb45ca7aa7b6fac (patch) | |
tree | 45c6e395fa38446c3fd7952f0e828ecd9dc5f5b0 /src | |
parent | 20754027b3b8c29dfc5ee0b5dfa6a5459ea6b903 (diff) | |
download | vim-2526ef276b97b1a5275fc0039fb45ca7aa7b6fac.zip |
updated for version 7.3.862
Problem: Dragging the status line can be slow.
Solution: Look ahead and drop the drag event if there is a next one.
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 22 | ||||
-rw-r--r-- | src/misc1.c | 57 | ||||
-rw-r--r-- | src/normal.c | 26 | ||||
-rw-r--r-- | src/proto/misc1.pro | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 63 insertions, 45 deletions
diff --git a/src/eval.c b/src/eval.c index ad200598b..7df4f7dda 100644 --- a/src/eval.c +++ b/src/eval.c @@ -11238,27 +11238,7 @@ f_getchar(argvars, rettv) rettv->vval.v_string = vim_strsave(temp); #ifdef FEAT_MOUSE - if (n == K_LEFTMOUSE - || n == K_LEFTMOUSE_NM - || n == K_LEFTDRAG - || n == K_LEFTRELEASE - || n == K_LEFTRELEASE_NM - || n == K_MIDDLEMOUSE - || n == K_MIDDLEDRAG - || n == K_MIDDLERELEASE - || n == K_RIGHTMOUSE - || n == K_RIGHTDRAG - || n == K_RIGHTRELEASE - || n == K_X1MOUSE - || n == K_X1DRAG - || n == K_X1RELEASE - || n == K_X2MOUSE - || n == K_X2DRAG - || n == K_X2RELEASE - || n == K_MOUSELEFT - || n == K_MOUSERIGHT - || n == K_MOUSEDOWN - || n == K_MOUSEUP) + if (is_mouse_key(n)) { int row = mouse_row; int col = mouse_col; diff --git a/src/misc1.c b/src/misc1.c index 5003ae5b1..94c2b4176 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3288,6 +3288,38 @@ ask_yesno(str, direct) return r; } +#if defined(FEAT_MOUSE) || defined(PROTO) +/* + * Return TRUE if "c" is a mouse key. + */ + int +is_mouse_key(c) + int c; +{ + return c == K_LEFTMOUSE + || c == K_LEFTMOUSE_NM + || c == K_LEFTDRAG + || c == K_LEFTRELEASE + || c == K_LEFTRELEASE_NM + || 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 + /* * Get a key stroke directly from the user. * Ignores mouse clicks and scrollbar events, except a click for the left @@ -3373,31 +3405,10 @@ get_keystroke() n = TO_SPECIAL(buf[1], buf[2]); if (buf[1] == KS_MODIFIER || n == K_IGNORE -#ifdef FEAT_MOUSE - || n == K_LEFTMOUSE_NM - || n == K_LEFTDRAG - || n == K_LEFTRELEASE - || n == K_LEFTRELEASE_NM - || n == K_MIDDLEMOUSE - || n == K_MIDDLEDRAG - || n == K_MIDDLERELEASE - || n == K_RIGHTMOUSE - || n == K_RIGHTDRAG - || n == K_RIGHTRELEASE - || n == K_MOUSEDOWN - || n == K_MOUSEUP - || n == K_MOUSELEFT - || n == K_MOUSERIGHT - || n == K_X1MOUSE - || n == K_X1DRAG - || n == K_X1RELEASE - || n == K_X2MOUSE - || n == K_X2DRAG - || n == K_X2RELEASE -# ifdef FEAT_GUI + || (is_mouse_key(n) && n != K_LEFTMOUSE) +#ifdef FEAT_GUI || n == K_VER_SCROLLBAR || n == K_HOR_SCROLLBAR -# endif #endif ) { diff --git a/src/normal.c b/src/normal.c index 3de170d6e..d6c0abb11 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2443,7 +2443,31 @@ do_mouse(oap, c, dir, count, fixindent) return FALSE; } - which_button = get_mouse_button(KEY2TERMCAP1(c), &is_click, &is_drag); + for (;;) + { + which_button = get_mouse_button(KEY2TERMCAP1(c), &is_click, &is_drag); + if (is_drag) + { + /* If the next character is the same mouse event then use that + * one. Speeds up dragging the status line. */ + if (vpeekc() != NUL) + { + int nc; + int save_mouse_row = mouse_row; + int save_mouse_col = mouse_col; + + /* Need to get the character, peeking doesn't get the actual + * one. */ + nc = safe_vgetc(); + if (c == nc) + continue; + vungetc(nc); + mouse_row = save_mouse_row; + mouse_col = save_mouse_col; + } + } + break; + } #ifdef FEAT_MOUSESHAPE /* May have stopped dragging the status or separator line. The pointer is diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro index d362e9cca..035453569 100644 --- a/src/proto/misc1.pro +++ b/src/proto/misc1.pro @@ -42,6 +42,7 @@ void unchanged __ARGS((buf_T *buf, int ff)); void check_status __ARGS((buf_T *buf)); void change_warning __ARGS((int col)); int ask_yesno __ARGS((char_u *str, int direct)); +int is_mouse_key __ARGS((int c)); int get_keystroke __ARGS((void)); int get_number __ARGS((int colon, int *mouse_used)); int prompt_for_number __ARGS((int *mouse_used)); diff --git a/src/version.c b/src/version.c index cf24d39aa..00024e359 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 862, +/**/ 861, /**/ 860, |