vim-patch:7.4.1970 (#5850)

Problem:    Using ":insert" in an empty buffer sets the jump mark. (Ingo
            Karkat)
Solution:   Don't adjust marks when replacing the empty line in an empty
            buffer. (closes vim/vim#892)

70e136e1d8
This commit is contained in:
lonerover 2017-01-01 00:32:50 +08:00 committed by Justin M. Keyes
parent b37da9c664
commit 5366242789
4 changed files with 15 additions and 3 deletions

View File

@ -2632,7 +2632,7 @@ void ex_append(exarg_T *eap)
if (eap->cmdidx != CMD_append) if (eap->cmdidx != CMD_append)
--lnum; --lnum;
/* when the buffer is empty append to line 0 and delete the dummy line */ // when the buffer is empty need to delete the dummy line
if (empty && lnum == 1) if (empty && lnum == 1)
lnum = 0; lnum = 0;
@ -2704,7 +2704,7 @@ void ex_append(exarg_T *eap)
did_undo = TRUE; did_undo = TRUE;
ml_append(lnum, theline, (colnr_T)0, FALSE); ml_append(lnum, theline, (colnr_T)0, FALSE);
appended_lines_mark(lnum, 1L); appended_lines_mark(lnum + (empty ? 1 : 0), 1L);
xfree(theline); xfree(theline);
++lnum; ++lnum;

View File

@ -9,6 +9,7 @@ source test_expr.vim
source test_expr_utf8.vim source test_expr_utf8.vim
source test_feedkeys.vim source test_feedkeys.vim
source test_goto.vim source test_goto.vim
source test_jumps.vim
source test_match.vim source test_match.vim
source test_matchadd_conceal_utf8.vim source test_matchadd_conceal_utf8.vim
source test_menu.vim source test_menu.vim

View File

@ -0,0 +1,11 @@
func Test_empty_buffer()
new
insert
a
b
c
d
.
call assert_equal(1, line("''"))
bwipe!
endfunc

View File

@ -470,7 +470,7 @@ static int included_patches[] = {
1973, 1973,
// 1972, // 1972,
1971, 1971,
// 1970, 1970,
// 1969 NA // 1969 NA
// 1968, // 1968,
1967, 1967,