diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-06-07 20:21:21 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-07-29 21:51:39 -0400 |
| commit | 3865b4320591d35b6a87671f6864ee72c85a0e05 (patch) | |
| tree | 1dc14f6f8bc7bbdb7e5efd9f8164ce2070d6cc5b /src/nvim/testdir | |
| parent | d628e4250fc5f7dfc3fe1bd537ce38b6171c138c (diff) | |
| download | rneovim-3865b4320591d35b6a87671f6864ee72c85a0e05.tar.gz rneovim-3865b4320591d35b6a87671f6864ee72c85a0e05.tar.bz2 rneovim-3865b4320591d35b6a87671f6864ee72c85a0e05.zip | |
vim-patch:8.2.2957: using getchar() in Vim9 script is problematic
Problem: Using getchar() in Vim9 script is problematic.
Solution: Add getcharstr(). (closes vim/vim#8343)
https://github.com/vim/vim/commit/3a7503c34c65ed15cc08deb5b54aaf2ea51525b4
Cherry-pick Test_getchar() changes from patch v8.1.2304
to sync with upstream.
Port f_getcharstr() to src/nvim/eval/funcs.c, not src/nvim/getchar.c.
Patch v8.1.2042 is not ported yet.
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_functions.vim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 7c00b479a3..bcf2edcc93 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1325,7 +1325,15 @@ 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) " let v:mouse_win = 9 " let v:mouse_winid = 9 @@ -1338,6 +1346,7 @@ func Test_getchar() call assert_equal(win_getid(1), v:mouse_winid) call assert_equal(1, v:mouse_lnum) call assert_equal(3, v:mouse_col) + enew! endfunc func Test_libcall_libcallnr() |