# HG changeset patch # User Bram Moolenaar # Date 1594315804 -7200 # Node ID e67123c115d22cb8a6cf7f532d7d9d87b55b4394 # Parent c383383768f414685f56da20b6b2281e3489b8ed patch 8.2.1166: once mouse move events are enabled getchar() returns them Commit: https://github.com/vim/vim/commit/ae97b94176062d30ea8c68bb83cde034c5150c78 Author: Bram Moolenaar Date: Thu Jul 9 19:16:35 2020 +0200 patch 8.2.1166: once mouse move events are enabled getchar() returns them Problem: Once mouse move events are enabled getchar() returns them. Solution: Ignore K_MOUSEMOVE in getchar(). (closes https://github.com/vim/vim/issues/6424) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5023,8 +5023,9 @@ getchar([expr]) *getchar()* When the user clicks a mouse button, the mouse event will be returned. The position can then be found in |v:mouse_col|, |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. - |getmousepos()| can also be used. This example positions the - mouse as it would normally happen: > + |getmousepos()| can also be used. Mouse move events will be + ignored. + This example positions the mouse as it would normally happen: > let c = getchar() if c == "\" && v:mouse_win > 0 exe v:mouse_win . "wincmd w" diff --git a/src/getchar.c b/src/getchar.c --- a/src/getchar.c +++ b/src/getchar.c @@ -1501,7 +1501,7 @@ openscript( { update_topline_cursor(); // update cursor position and topline normal_cmd(&oa, FALSE); // execute one command - vpeekc(); // check for end of file + (void)vpeekc(); // check for end of file } while (scriptin[oldcurscript] != NULL); @@ -2045,7 +2045,7 @@ f_getchar(typval_T *argvars, typval_T *r // getchar(0) and char avail: return char n = plain_vgetc(); - if (n == K_IGNORE) + if (n == K_IGNORE || n == K_MOUSEMOVE) continue; break; } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1166, +/**/ 1165, /**/ 1164,