diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-02-17 07:18:10 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-17 08:44:58 +0800 |
| commit | c90cf8c77b96cda0fd40dbf4aa2c1762cd09dab3 (patch) | |
| tree | 9f2b538618f1563ad64798520d77763b01b936d7 /src/nvim/testdir/test_mapping.vim | |
| parent | 3230b314862e50899d68b3944134cbffaa797cde (diff) | |
| download | rneovim-c90cf8c77b96cda0fd40dbf4aa2c1762cd09dab3.tar.gz rneovim-c90cf8c77b96cda0fd40dbf4aa2c1762cd09dab3.tar.bz2 rneovim-c90cf8c77b96cda0fd40dbf4aa2c1762cd09dab3.zip | |
vim-patch:8.1.2336: when an expr mapping moves the cursor it is not restored
Problem: When an expr mapping moves the cursor it is not restored.
Solution: Position the cursor after an expr mapping. (closes vim/vim#5256)
https://github.com/vim/vim/commit/4ebe0e62d097d68c5312f9c32714fb41a4c947a3
Diffstat (limited to 'src/nvim/testdir/test_mapping.vim')
| -rw-r--r-- | src/nvim/testdir/test_mapping.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index f88e8cf843..749c75106e 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -1,6 +1,8 @@ " Tests for mappings and abbreviations source shared.vim +source check.vim +source screendump.vim func Test_abbreviation() " abbreviation with 0x80 should work @@ -451,6 +453,36 @@ func Test_expr_map_gets_cursor() nunmap ! endfunc +func Test_expr_map_restore_cursor() + CheckScreendump + + let lines =<< trim END + call setline(1, ['one', 'two', 'three']) + 2 + set ls=2 + hi! link StatusLine ErrorMsg + noremap <expr> <C-B> Func() + func Func() + let g:on = !get(g:, 'on', 0) + redraws + return '' + endfunc + func Status() + return get(g:, 'on', 0) ? '[on]' : '' + endfunc + set stl=%{Status()} + END + call writefile(lines, 'XtestExprMap') + let buf = RunVimInTerminal('-S XtestExprMap', #{rows: 10}) + call term_wait(buf) + call term_sendkeys(buf, "\<C-B>") + call VerifyScreenDump(buf, 'Test_map_expr_1', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XtestExprMap') +endfunc + " Test for mapping errors func Test_map_error() call assert_fails('unmap', 'E474:') |