summaryrefslogtreecommitdiff
path: root/src/testdir/test_mapping.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-03-17 13:28:05 +0100
committerBram Moolenaar <Bram@vim.org>2021-03-17 13:28:05 +0100
commit18b7d86d7fa997bbb02a069dafacb32a0f73ca1e (patch)
tree31c279c6d747651f0bcaae89d24b5ecb2ec8163f /src/testdir/test_mapping.vim
parentf8c52e8d08de3fdf48db877d7d53d2d68c6ceb7b (diff)
downloadvim-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.vim24
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