diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-01 14:04:51 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-01 14:04:51 +0200 |
commit | 70e136e1d86ea1d795774824c7b712245912946d (patch) | |
tree | 4cb74e5694a9b551be06953a6c3c1382fc73c90f /src | |
parent | 24cf233ef9e92f947618c55d8bff423898a45c24 (diff) | |
download | vim-git-70e136e1d86ea1d795774824c7b712245912946d.tar.gz |
patch 7.4.1970v7.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)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds.c | 4 | ||||
-rw-r--r-- | src/testdir/test_alot.vim | 1 | ||||
-rw-r--r-- | src/testdir/test_jumps.vim | 11 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index f58bad7be..36d7bd195 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4372,7 +4372,7 @@ ex_append(exarg_T *eap) if (eap->cmdidx != CMD_append) --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) lnum = 0; @@ -4456,7 +4456,7 @@ ex_append(exarg_T *eap) did_undo = TRUE; ml_append(lnum, theline, (colnr_T)0, FALSE); - appended_lines_mark(lnum, 1L); + appended_lines_mark(lnum + (empty ? 1 : 0), 1L); vim_free(theline); ++lnum; diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 444085e18..76134fb66 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -16,6 +16,7 @@ source test_glob2regpat.vim 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 diff --git a/src/testdir/test_jumps.vim b/src/testdir/test_jumps.vim new file mode 100644 index 000000000..5a3717d16 --- /dev/null +++ b/src/testdir/test_jumps.vim @@ -0,0 +1,11 @@ +func Test_empty_buffer() + new + insert +a +b +c +d +. + call assert_equal(1, line("''")) + bwipe! +endfunc diff --git a/src/version.c b/src/version.c index 8e9da45f8..774d309d3 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1970, +/**/ 1969, /**/ 1968, |