diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-17 13:28:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-17 13:28:05 +0100 |
commit | 18b7d86d7fa997bbb02a069dafacb32a0f73ca1e (patch) | |
tree | 31c279c6d747651f0bcaae89d24b5ecb2ec8163f /src/testdir/test_mapping.vim | |
parent | f8c52e8d08de3fdf48db877d7d53d2d68c6ceb7b (diff) | |
download | vim-git-18b7d86d7fa997bbb02a069dafacb32a0f73ca1e.tar.gz |
patch 8.2.2612: col('.') may get outdated column valuev8.2.2612
Problem: col('.') may get outdated column value.
Solution: Add a note to the help how to make this work and add a test for
it. (closes #7971)
Diffstat (limited to 'src/testdir/test_mapping.vim')
-rw-r--r-- | src/testdir/test_mapping.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index 1750f39d5..f76718fca 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -485,6 +485,30 @@ func Test_list_mappings() nmapclear endfunc +func Test_expr_map_gets_cursor() + new + call setline(1, ['one', 'some w!rd']) + func StoreColumn() + let g:exprLine = line('.') + let g:exprCol = col('.') + return 'x' + endfunc + nnoremap <expr> x StoreColumn() + 2 + nmap ! f!<Ignore>x + call feedkeys("!", 'xt') + call assert_equal('some wrd', getline(2)) + call assert_equal(2, g:exprLine) + call assert_equal(7, g:exprCol) + + bwipe! + unlet g:exprLine + unlet g:exprCol + delfunc ExprMapped + nunmap x + nunmap ! +endfunc + func Test_expr_map_restore_cursor() CheckScreendump |