]> granicus.if.org Git - vim/commitdiff
patch 8.2.1166: once mouse move events are enabled getchar() returns them v8.2.1166
authorBram Moolenaar <Bram@vim.org>
Thu, 9 Jul 2020 17:16:35 +0000 (19:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 9 Jul 2020 17:16:35 +0000 (19:16 +0200)
Problem:    Once mouse move events are enabled getchar() returns them.
Solution:   Ignore K_MOUSEMOVE in getchar(). (closes #6424)

runtime/doc/eval.txt
src/getchar.c
src/version.c

index 10b57b7b87511dac624951e567b5e6ec40d3d228..08399b8e0c59ca4302373564f70ecdea7ac319e5 100644 (file)
@@ -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 == "\<LeftMouse>" && v:mouse_win > 0
                          exe v:mouse_win . "wincmd w"
index 2beffa57844de34fc0cacbc07a8d24cd371be398..e040748d66c1fd26dbb7c265599bddaff42da816 100644 (file)
@@ -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 *rettv)
            // getchar(0) and char avail: return char
            n = plain_vgetc();
 
-       if (n == K_IGNORE)
+       if (n == K_IGNORE || n == K_MOUSEMOVE)
            continue;
        break;
     }
index 06f3f27caa07b1743dad57d40fc566fb6928b085..9fcf578ffc0bf20eb9cd6b7ed57e575398bd20a9 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1166,
 /**/
     1165,
 /**/