diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-22 20:55:40 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-22 20:55:40 +0100 |
commit | 4ebe0e62d097d68c5312f9c32714fb41a4c947a3 (patch) | |
tree | a5ab5da2bf923c76de42263032609ac02a81c0ea /src/testdir/test_mapping.vim | |
parent | 2118a302957dea352174722bf355376901f49b9b (diff) | |
download | vim-git-4ebe0e62d097d68c5312f9c32714fb41a4c947a3.tar.gz |
patch 8.1.2336: when an expr mapping moves the cursor it is not restoredv8.1.2336
Problem: When an expr mapping moves the cursor it is not restored.
Solution: Position the cursor after an expr mapping. (closes #5256)
Diffstat (limited to 'src/testdir/test_mapping.vim')
-rw-r--r-- | src/testdir/test_mapping.vim | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index 4ba364598..d3abaff9b 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -2,6 +2,7 @@ source shared.vim source check.vim +source screendump.vim func Test_abbreviation() " abbreviation with 0x80 should work @@ -461,3 +462,33 @@ func Test_list_mappings() iunmap <S-/> call assert_equal(['No mapping found'], execute('imap')->trim()->split("\n")) 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 |