Patch 8.0.1374
Problem: CTRL-A does not work with an empty line. (Alex)
Solution: Decrement the end only once. (Hirohito Higashi, closes #2387)
Files: src/ops.c, src/testdir/test_increment.vim
*** ../vim-8.0.1373/src/ops.c 2017-10-15 21:46:57.700140459 +0200
--- src/ops.c 2017-12-05 17:12:55.005734563 +0100
***************
*** 5433,5439 ****
}
else /* oap->motion_type == MCHAR */
{
! if (!oap->inclusive)
dec(&(oap->end));
length = (colnr_T)STRLEN(ml_get(pos.lnum));
pos.col = 0;
--- 5433,5439 ----
}
else /* oap->motion_type == MCHAR */
{
! if (pos.lnum == oap->start.lnum && !oap->inclusive)
dec(&(oap->end));
length = (colnr_T)STRLEN(ml_get(pos.lnum));
pos.col = 0;
*** ../vim-8.0.1373/src/testdir/test_increment.vim 2016-08-18
21:35:09.000000000 +0200
--- src/testdir/test_increment.vim 2017-12-05 17:12:34.709845302 +0100
***************
*** 364,374 ****
--- 364,388 ----
" Expected:
" 1) Ctrl-a on visually selected zero
" 111
+ "
+ " Also: 019 with "01" selected increments to "029".
func Test_visual_increment_15()
call setline(1, ["101"])
exec "norm! lv\<C-A>"
call assert_equal(["111"], getline(1, '$'))
call assert_equal([0, 1, 2, 0], getpos('.'))
+
+ call setline(1, ["019"])
+ exec "norm! 0vl\<C-A>"
+ call assert_equal("029", getline(1))
+
+ call setline(1, ["01239"])
+ exec "norm! 0vlll\<C-A>"
+ call assert_equal("01249", getline(1))
+
+ call setline(1, ["01299"])
+ exec "norm! 0vlll\<C-A>"
+ call assert_equal("1309", getline(1))
endfunc
" 16) increment right aligned numbers
***************
*** 756,760 ****
--- 770,781 ----
call assert_equal([0, 3, 25, 0], getpos('.'))
endfunc
+ func Test_increment_empty_line()
+ new
+ call setline(1, ['0', '0', '0', '0', '0', '0', ''])
+ exe "normal Gvgg\<C-A>"
+ call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
+ bwipe!
+ endfunc
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.0.1373/src/version.c 2017-12-05 16:57:52.230668085 +0100
--- src/version.c 2017-12-05 17:13:25.733566910 +0100
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1374,
/**/
--
hundred-and-one symptoms of being an internet addict:
87. Everyone you know asks why your phone line is always busy ...and
you tell them to send an e-mail.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.