comparison src/testdir/test_increment.vim @ 12996:973a0037f4c3 v8.0.1374

patch 8.0.1374: CTRL-A does not work with an empty line commit https://github.com/vim/vim/commit/5fe6bdf858a7f2f288d599ffb5efb3c08449c817 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 5 17:22:12 2017 +0100 patch 8.0.1374: CTRL-A does not work with an empty line Problem: CTRL-A does not work with an empty line. (Alex) Solution: Decrement the end only once. (Hirohito Higashi, closes https://github.com/vim/vim/issues/2387)
author Christian Brabandt <cb@256bit.org>
date Tue, 05 Dec 2017 17:30:05 +0100
parents 3ee84d270ea7
children f70a3c1000bb
comparison
equal deleted inserted replaced
12995:814c18a298a9 12996:973a0037f4c3
362 " Text: 362 " Text:
363 " 101 363 " 101
364 " Expected: 364 " Expected:
365 " 1) Ctrl-a on visually selected zero 365 " 1) Ctrl-a on visually selected zero
366 " 111 366 " 111
367 "
368 " Also: 019 with "01" selected increments to "029".
367 func Test_visual_increment_15() 369 func Test_visual_increment_15()
368 call setline(1, ["101"]) 370 call setline(1, ["101"])
369 exec "norm! lv\<C-A>" 371 exec "norm! lv\<C-A>"
370 call assert_equal(["111"], getline(1, '$')) 372 call assert_equal(["111"], getline(1, '$'))
371 call assert_equal([0, 1, 2, 0], getpos('.')) 373 call assert_equal([0, 1, 2, 0], getpos('.'))
374
375 call setline(1, ["019"])
376 exec "norm! 0vl\<C-A>"
377 call assert_equal("029", getline(1))
378
379 call setline(1, ["01239"])
380 exec "norm! 0vlll\<C-A>"
381 call assert_equal("01249", getline(1))
382
383 call setline(1, ["01299"])
384 exec "norm! 0vlll\<C-A>"
385 call assert_equal("1309", getline(1))
372 endfunc 386 endfunc
373 387
374 " 16) increment right aligned numbers 388 " 16) increment right aligned numbers
375 " Text: 389 " Text:
376 " 1 390 " 1
754 \ "-1 0x0 078 0xFE 0xfe", 768 \ "-1 0x0 078 0xFE 0xfe",
755 \ "-100 -100x100 000 "], getline(1, '$')) 769 \ "-100 -100x100 000 "], getline(1, '$'))
756 call assert_equal([0, 3, 25, 0], getpos('.')) 770 call assert_equal([0, 3, 25, 0], getpos('.'))
757 endfunc 771 endfunc
758 772
773 func Test_increment_empty_line()
774 new
775 call setline(1, ['0', '0', '0', '0', '0', '0', ''])
776 exe "normal Gvgg\<C-A>"
777 call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
778 bwipe!
779 endfunc
759 780
760 " vim: shiftwidth=2 sts=2 expandtab 781 " vim: shiftwidth=2 sts=2 expandtab