vim-patch:8.1.0995: a getchar() call resets the reg_executing() result

Problem:    A getchar() call while executing a register resets the
            reg_executing() result.
Solution:   Save and restore reg_executing. (closes vim/vim#406
f0fab3046c
This commit is contained in:
Jan Edmund Lazo
2019-05-26 20:50:54 -04:00
parent 21f160746a
commit 2393611588
2 changed files with 23 additions and 0 deletions

View File

@@ -1097,6 +1097,27 @@ func Test_reg_executing_and_recording()
call feedkeys("q\"\"=s:save_reg_stat()\<CR>pq", 'xt')
call assert_equal('":', s:reg_stat)
" :normal command saves and restores reg_executing
let s:reg_stat = ''
" 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