aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-26 20:56:33 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-26 20:58:57 -0400
commitb2a11515b2cf6923dd0c1a36efe22aabf6bc582c (patch)
tree2d59638ea24d1c25921929eb1d0e7fc738074988 /src/nvim/testdir
parent23936115880ba3c9e716f9c3b5d7b89453cd65fc (diff)
downloadrneovim-b2a11515b2cf6923dd0c1a36efe22aabf6bc582c.tar.gz
rneovim-b2a11515b2cf6923dd0c1a36efe22aabf6bc582c.tar.bz2
rneovim-b2a11515b2cf6923dd0c1a36efe22aabf6bc582c.zip
vim-patch:8.1.1077: reg_executing() is reset by calling input()
Problem: reg_executing() is reset by calling input(). Solution: Implement a more generic way to save and restore reg_executing. (Ozaki Kiichi, closes vim/vim#4192) https://github.com/vim/vim/commit/9a2c091a748b380efafe60583698c9afcaab1e46
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_functions.vim30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index d58e4f8758..ed9c70403e 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1103,20 +1103,38 @@ func Test_reg_executing_and_recording()
" getchar() command saves and restores reg_executing
map W :call TestFunc()<CR>
let @q = "W"
+ let g:typed = ''
+ let g:regs = []
func TestFunc() abort
- let g:reg1 = reg_executing()
+ let g:regs += [reg_executing()]
let g:typed = getchar(0)
- let g:reg2 = reg_executing()
+ let g:regs += [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)
+ call assert_equal(['q', 'q'], g:regs)
delfunc TestFunc
unmap W
unlet g:typed
- unlet g:reg1
- unlet g:reg2
+ unlet g:regs
+
+ " input() command saves and restores reg_executing
+ map W :call TestFunc()<CR>
+ let @q = "W"
+ let g:typed = ''
+ let g:regs = []
+ func TestFunc() abort
+ let g:regs += [reg_executing()]
+ let g:typed = input('?')
+ let g:regs += [reg_executing()]
+ endfunc
+ call feedkeys("@qy\<CR>", 'xt')
+ call assert_equal("y", g:typed)
+ call assert_equal(['q', 'q'], g:regs)
+ delfunc TestFunc
+ unmap W
+ unlet g:typed
+ unlet g:regs
bwipe!
delfunc s:save_reg_stat