summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-30 14:26:18 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-30 14:26:18 +0100
commit9a2c091a748b380efafe60583698c9afcaab1e46 (patch)
tree9fd1e3baabc53307e56cebe260692a013ee7065e /src/testdir/test_functions.vim
parent7591bb39d58ece38a5fef984a08ea9012616c1f9 (diff)
patch 8.1.1077: reg_executing() is reset by calling input()v8.1.1077
Problem: reg_executing() is reset by calling input(). Solution: Implement a more generic way to save and restore reg_executing. (Ozaki Kiichi, closes #4192)
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index d53499950e..63f477db9a 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1150,20 +1150,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