fix(input): use correct grid when restoring cursor for <expr> mapping (#19047)

This commit is contained in:
zeertzjq
2022-06-23 06:04:03 +08:00
committed by GitHub
parent c94325288a
commit 801faeaae2
3 changed files with 24 additions and 6 deletions

View File

@@ -86,7 +86,7 @@ n asdf1 qwert
end)
end)
describe(':*map cursor and redrawing', function()
describe('Screen', function()
local screen
before_each(function()
clear()
@@ -149,6 +149,18 @@ describe(':*map cursor and redrawing', function()
]])
end)
it('cursor position does not move after empty-string :cmap <expr> #19046', function()
command([[cnoremap <expr> <F2> '']])
feed(':<F2>')
screen:expect([[
|
~ |
~ |
~ |
:^ |
]])
end)
it('cursor is restored after :map <expr> which redraws statusline vim-patch:8.1.2336', function()
exec([[
call setline(1, ['one', 'two', 'three'])
@@ -157,12 +169,12 @@ describe(':*map cursor and redrawing', function()
hi! link StatusLine ErrorMsg
noremap <expr> <C-B> Func()
func Func()
let g:on = !get(g:, 'on', 0)
redraws
return ''
let g:on = !get(g:, 'on', 0)
redraws
return ''
endfunc
func Status()
return get(g:, 'on', 0) ? '[on]' : ''
return get(g:, 'on', 0) ? '[on]' : ''
endfunc
set stl=%{Status()}
]])