0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.0963: number increment/decrement does not work with 'virtualedit'

Problem:    Number increment/decrement does not work with 'virtualedit'.
Solution:   Handle coladd changing. (Christian Brabandt, closes #6240,
            closes #923)
This commit is contained in:
Bram Moolenaar
2020-06-12 20:19:44 +02:00
parent f6e020b122
commit 6c6be9e88d
5 changed files with 49 additions and 4 deletions

View File

@@ -840,4 +840,40 @@ func Test_increment_unsigned()
set nrformats-=unsigned
endfunc
func Test_normal_increment_with_virtualedit()
set virtualedit=all
call setline(1, ["\<TAB>1"])
exec "norm! 0\<C-A>"
call assert_equal("\<TAB>2", getline(1))
call assert_equal([0, 1, 2, 0], getpos('.'))
call setline(1, ["\<TAB>1"])
exec "norm! 0l\<C-A>"
call assert_equal("\<TAB>2", getline(1))
call assert_equal([0, 1, 2, 0], getpos('.'))
call setline(1, ["\<TAB>1"])
exec "norm! 07l\<C-A>"
call assert_equal("\<TAB>2", getline(1))
call assert_equal([0, 1, 2, 0], getpos('.'))
call setline(1, ["\<TAB>1"])
exec "norm! 0w\<C-A>"
call assert_equal("\<TAB>2", getline(1))
call assert_equal([0, 1, 2, 0], getpos('.'))
call setline(1, ["\<TAB>1"])
exec "norm! 0wl\<C-A>"
call assert_equal("\<TAB>1", getline(1))
call assert_equal([0, 1, 3, 0], getpos('.'))
call setline(1, ["\<TAB>1"])
exec "norm! 0w30l\<C-A>"
call assert_equal("\<TAB>1", getline(1))
call assert_equal([0, 1, 3, 29], getpos('.'))
set virtualedit&
endfunc
" vim: shiftwidth=2 sts=2 expandtab