Patch 7.4.1513
Problem: "J" fails if there are not enough lines. (Christian Neukirchen)
Solution: Reduce the count, only fail on the last line.
Files: src/normal.c, src/testdir/test_join.vim, src/testdir/test_alot.vim
*** ../vim-7.4.1512/src/normal.c 2016-02-27 18:13:05.236593109 +0100
--- src/normal.c 2016-03-08 14:41:31.938372951 +0100
***************
*** 9213,9225 ****
cap->count0 = 2; /* default for join is two lines! */
if (curwin->w_cursor.lnum + cap->count0 - 1 >
curbuf->b_ml.ml_line_count)
- clearopbeep(cap->oap); /* beyond last line */
- else
{
! prep_redo(cap->oap->regname, cap->count0,
! NUL, cap->cmdchar, NUL, NUL, cap->nchar);
! (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
}
}
}
--- 9213,9232 ----
cap->count0 = 2; /* default for join is two lines! */
if (curwin->w_cursor.lnum + cap->count0 - 1 >
curbuf->b_ml.ml_line_count)
{
! /* can't join when on the last line */
! if (cap->count0 <= 2)
! {
! clearopbeep(cap->oap);
! return;
! }
! cap->count0 = curbuf->b_ml.ml_line_count
! - curwin->w_cursor.lnum + 1;
}
+
+ prep_redo(cap->oap->regname, cap->count0,
+ NUL, cap->cmdchar, NUL, NUL, cap->nchar);
+ (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
}
}
*** ../vim-7.4.1512/src/testdir/test_join.vim 2016-03-08 14:44:19.404603493
+0100
--- src/testdir/test_join.vim 2016-03-08 14:37:16.741070878 +0100
***************
*** 0 ****
--- 1,13 ----
+ " Test for joining lines.
+
+ func Test_join_with_count()
+ new
+ call setline(1, ['one', 'two', 'three', 'four'])
+ normal J
+ call assert_equal('one two', getline(1))
+ %del
+ call setline(1, ['one', 'two', 'three', 'four'])
+ normal 10J
+ call assert_equal('one two three four', getline(1))
+ quit!
+ endfunc
*** ../vim-7.4.1512/src/testdir/test_alot.vim 2016-02-28 18:03:55.690659915
+0100
--- src/testdir/test_alot.vim 2016-03-08 14:31:57.560447933 +0100
***************
*** 6,11 ****
--- 6,12 ----
source test_delete.vim
source test_expand.vim
source test_glob2regpat.vim
+ source test_join.vim
source test_lispwords.vim
source test_menu.vim
source test_reltime.vim
*** ../vim-7.4.1512/src/version.c 2016-03-08 13:48:43.003473447 +0100
--- src/version.c 2016-03-08 14:41:45.646228085 +0100
***************
*** 745,746 ****
--- 745,748 ----
{ /* Add new patch number below this line */
+ /**/
+ 1513,
/**/
--
hundred-and-one symptoms of being an internet addict:
7. You finally do take that vacation, but only after buying a cellular modem
and a laptop.
/// 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.