To: vim_dev@googlegroups.com Subject: Patch 7.4.1970 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1970 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 #892) Files: src/ex_cmds.c, src/testdir/test_jumps.vim, src/testdir/test_alot.vim *** ../vim-7.4.1969/src/ex_cmds.c 2016-06-26 16:44:19.511621004 +0200 --- src/ex_cmds.c 2016-07-01 13:58:18.744545109 +0200 *************** *** 4372,4378 **** if (eap->cmdidx != CMD_append) --lnum; ! /* when the buffer is empty append to line 0 and delete the dummy line */ if (empty && lnum == 1) lnum = 0; --- 4372,4378 ---- if (eap->cmdidx != CMD_append) --lnum; ! /* when the buffer is empty need to delete the dummy line */ if (empty && lnum == 1) lnum = 0; *************** *** 4456,4462 **** did_undo = TRUE; ml_append(lnum, theline, (colnr_T)0, FALSE); ! appended_lines_mark(lnum, 1L); vim_free(theline); ++lnum; --- 4456,4462 ---- did_undo = TRUE; ml_append(lnum, theline, (colnr_T)0, FALSE); ! appended_lines_mark(lnum + (empty ? 1 : 0), 1L); vim_free(theline); ++lnum; *** ../vim-7.4.1969/src/testdir/test_jumps.vim 2016-07-01 14:04:15.323164199 +0200 --- src/testdir/test_jumps.vim 2016-07-01 13:45:45.251952741 +0200 *************** *** 0 **** --- 1,11 ---- + func Test_empty_buffer() + new + insert + a + b + c + d + . + call assert_equal(1, line("''")) + bwipe! + endfunc *** ../vim-7.4.1969/src/testdir/test_alot.vim 2016-06-26 18:37:51.890998592 +0200 --- src/testdir/test_alot.vim 2016-07-01 13:45:05.976548875 +0200 *************** *** 16,21 **** --- 16,22 ---- source test_goto.vim source test_help_tagjump.vim source test_join.vim + source test_jumps.vim source test_lispwords.vim source test_matchstrpos.vim source test_menu.vim *** ../vim-7.4.1969/src/version.c 2016-07-01 12:50:50.056997079 +0200 --- src/version.c 2016-07-01 13:53:58.364481189 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1970, /**/ -- An error has occurred. Hit any user to continue. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///