1
0
forked from aniani/vim

patch 8.2.2957: using getchar() in Vim9 script is problematic

Problem:    Using getchar() in Vim9 script is problematic.
Solution:   Add getcharstr(). (closes #8343)
This commit is contained in:
Bram Moolenaar
2021-06-07 18:29:17 +02:00
parent f05d2fc539
commit 3a7503c34c
6 changed files with 70 additions and 5 deletions

View File

@@ -1729,6 +1729,13 @@ endfunc
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)