changeset 22117:3ea773da9c4f v8.2.1608

patch 8.2.1608: Vim9: getchar() test fails with GUI Commit: https://github.com/vim/vim/commit/15183b41c4416b7638cce26de0a9a83e55948bdc Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 5 19:59:39 2020 +0200 patch 8.2.1608: Vim9: getchar() test fails with GUI Problem: Vim9: getchar() test fails with GUI. Solution: Avoid that getchar(0) gets stuck on K_IGNORE.
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Sep 2020 20:00:03 +0200
parents 029ba7a35f7f
children 9a515354454d
files src/getchar.c src/version.c
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2044,10 +2044,12 @@ f_getchar(typval_T *argvars, typval_T *r
 	    // illegal argument or getchar(0) and no char avail: return zero
 	    n = 0;
 	else
-	    // getchar(0) and char avail: return char
-	    n = plain_vgetc();
-
-	if (n == K_IGNORE || n == K_MOUSEMOVE)
+	    // 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
+		|| n == K_VER_SCROLLBAR || n == K_HOR_SCROLLBAR)
 	    continue;
 	break;
     }
--- 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 */
 /**/
+    1608,
+/**/
     1607,
 /**/
     1606,