]> granicus.if.org Git - vim/commitdiff
patch 8.2.1608: Vim9: getchar() test fails with GUI v8.2.1608
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 17:59:39 +0000 (19:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 17:59:39 +0000 (19:59 +0200)
Problem:    Vim9: getchar() test fails with GUI.
Solution:   Avoid that getchar(0) gets stuck on K_IGNORE.

src/getchar.c
src/version.c

index 4f5ea463906e97bd37ba053752846974e0dd3e3b..e42fc332cccf26abd72408f44290886331d73694 100644 (file)
@@ -2044,10 +2044,12 @@ f_getchar(typval_T *argvars, typval_T *rettv)
            // illegal argument or getchar(0) and no char avail: return zero
            n = 0;
        else
-           // getchar(0) and char avail: return char
-           n = plain_vgetc();
+           // getchar(0) and char avail() != NUL: get a character.
+           // Note that vpeekc_any() returns K_SPECIAL for K_IGNORE.
+           n = safe_vgetc();
 
-       if (n == K_IGNORE || n == K_MOUSEMOVE)
+       if (n == K_IGNORE || n == K_MOUSEMOVE
+               || n == K_VER_SCROLLBAR || n == K_HOR_SCROLLBAR)
            continue;
        break;
     }
index c306c8858741db2fd0d5ab2358b806a4fe903e40..e1cdba6d6c99d4c46527c38664d78e832972118f 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1608,
 /**/
     1607,
 /**/