aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlonerover <pathfinder1644@yahoo.com>2017-01-01 00:32:50 +0800
committerJustin M. Keyes <justinkz@gmail.com>2016-12-31 17:32:50 +0100
commit5366242789a4c2f53c52d2fe2f6be7284fcc73b5 (patch)
tree24d8f8750b2053d10d8f46fbf876a333cbdeec1d /src
parentb37da9c66425464aa6a44eeffe9f05173dc42254 (diff)
downloadrneovim-5366242789a4c2f53c52d2fe2f6be7284fcc73b5.tar.gz
rneovim-5366242789a4c2f53c52d2fe2f6be7284fcc73b5.tar.bz2
rneovim-5366242789a4c2f53c52d2fe2f6be7284fcc73b5.zip
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) https://github.com/vim/vim/commit/70e136e1d86ea1d795774824c7b712245912946d
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_jumps.vim11
-rw-r--r--src/nvim/version.c2
4 files changed, 15 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 42af5989a1..73a1ab7723 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2632,7 +2632,7 @@ void 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;
@@ -2704,7 +2704,7 @@ void 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);
xfree(theline);
++lnum;
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim
index 5da122c45d..818ff7cf54 100644
--- a/src/nvim/testdir/test_alot.vim
+++ b/src/nvim/testdir/test_alot.vim
@@ -9,6 +9,7 @@ source test_expr.vim
source test_expr_utf8.vim
source test_feedkeys.vim
source test_goto.vim
+source test_jumps.vim
source test_match.vim
source test_matchadd_conceal_utf8.vim
source test_menu.vim
diff --git a/src/nvim/testdir/test_jumps.vim b/src/nvim/testdir/test_jumps.vim
new file mode 100644
index 0000000000..5a3717d165
--- /dev/null
+++ b/src/nvim/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/nvim/version.c b/src/nvim/version.c
index ff77e29404..0921749eb5 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -470,7 +470,7 @@ static int included_patches[] = {
1973,
// 1972,
1971,
- // 1970,
+ 1970,
// 1969 NA
// 1968,
1967,