diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-03-05 12:24:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-03-05 12:24:10 +0100 |
commit | f0fab3046c2b5c4115979347464a802853011220 (patch) | |
tree | 5aa4e6a0094657524d0337111d77b0e5fae6c080 /src/testdir/test_functions.vim | |
parent | 8fcb60f961bdd134599fb016c6537fd496e800f5 (diff) |
patch 8.1.0995: a getchar() call resets the reg_executing() resultv8.1.0995
Problem: A getchar() call while executing a register resets the
reg_executing() result.
Solution: Save and restore reg_executing. (closes #406
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r-- | src/testdir/test_functions.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 43c0f63c21..d53499950e 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -1138,6 +1138,7 @@ func Test_reg_executing_and_recording() call assert_equal('":', s:reg_stat) " :normal command saves and restores reg_executing + let s:reg_stat = '' let @q = ":call TestFunc()\<CR>:call s:save_reg_stat()\<CR>" func TestFunc() abort normal! ia @@ -1146,6 +1147,24 @@ func Test_reg_executing_and_recording() call assert_equal(':q', s:reg_stat) delfunc TestFunc + " getchar() command saves and restores reg_executing + map W :call TestFunc()<CR> + let @q = "W" + func TestFunc() abort + let g:reg1 = reg_executing() + let g:typed = getchar(0) + let g:reg2 = reg_executing() + endfunc + call feedkeys("@qy", 'xt') + call assert_equal(char2nr("y"), g:typed) + call assert_equal('q', g:reg1) + call assert_equal('q', g:reg2) + delfunc TestFunc + unmap W + unlet g:typed + unlet g:reg1 + unlet g:reg2 + bwipe! delfunc s:save_reg_stat unlet s:reg_stat |