diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-06 00:23:18 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-06 00:26:37 -0400 |
commit | f70ecbd4dc548728d206e9b497cd0cae69189fdf (patch) | |
tree | 2ce17ae88a0e8ece2b383e8780e1a297a1800f5e | |
parent | 51403d6d411ca9bc8b4e8d66003a52781e5c698e (diff) | |
download | rneovim-f70ecbd4dc548728d206e9b497cd0cae69189fdf.tar.gz rneovim-f70ecbd4dc548728d206e9b497cd0cae69189fdf.tar.bz2 rneovim-f70ecbd4dc548728d206e9b497cd0cae69189fdf.zip |
vim-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 vim/vim#6424)
https://github.com/vim/vim/commit/ae97b94176062d30ea8c68bb83cde034c5150c78
-rw-r--r-- | runtime/doc/eval.txt | 5 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 5 | ||||
-rw-r--r-- | src/nvim/getchar.c | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b4630a97bb..72c0bec4ff 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4316,8 +4316,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|. This - example positions the mouse as it would normally happen: > + |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. + Mouse move events will be ignored. + This example positions the mouse as it would normally happen: > let c = getchar() if c == "\<LeftMouse>" && v:mouse_win > 0 exe v:mouse_win . "wincmd w" diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 6d328953f6..60af592108 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -3016,7 +3016,10 @@ static void f_getchar(typval_T *argvars, typval_T *rettv, FunPtr fptr) n = safe_vgetc(); } - if (n == K_IGNORE || n == K_VER_SCROLLBAR || n == K_HOR_SCROLLBAR) { + if (n == K_IGNORE + || n == K_MOUSEMOVE + || n == K_VER_SCROLLBAR + || n == K_HOR_SCROLLBAR) { continue; } break; diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index bb406a68c5..a0fa80f1e5 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1322,7 +1322,7 @@ void openscript( do { 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); State = save_State; |