patch 8.2.2957: using getchar() in Vim9 script is problematic
Problem: Using getchar() in Vim9 script is problematic.
Solution: Add getcharstr(). (closes #8343)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 023da66..1309554 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1729,6 +1729,13 @@
func Test_getchar()
call feedkeys('a', '')
call assert_equal(char2nr('a'), getchar())
+ call assert_equal(0, getchar(0))
+ call assert_equal(0, getchar(1))
+
+ call feedkeys('a', '')
+ call assert_equal('a', getcharstr())
+ call assert_equal('', getcharstr(0))
+ call assert_equal('', getcharstr(1))
call setline(1, 'xxxx')
call test_setmouse(1, 3)