forked from aniani/vim
patch 8.2.2612: col('.') may get outdated column value
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)
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user