aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2016-01-14 12:43:07 +0900
committerwatiko <service@mail.watiko.net>2016-02-01 03:47:09 +0900
commit40149a9dbf475ad1d0dec9a9494a32c26a6536ce (patch)
treef54bed2f697f3a01fa225eb3efdfb9fa86aa5efe /src
parent2f52ae18e75a85af78b78587d5b44b6d8d4814b7 (diff)
downloadrneovim-40149a9dbf475ad1d0dec9a9494a32c26a6536ce.tar.gz
rneovim-40149a9dbf475ad1d0dec9a9494a32c26a6536ce.tar.bz2
rneovim-40149a9dbf475ad1d0dec9a9494a32c26a6536ce.zip
vim-patch:7.4.634
Problem: Marks are not restored after redo + undo. Solution: Fix the way marks are restored. (Olaf Dabrunz) https://github.com/vim/vim/commit/f65aad5554f1d1f972f0bd38059da70e3cdf4c87 https://github.com/vim/vim/commit/35e7594dd429f7a8a06cefd61c3e8d48b9bd74e2
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test_marks.in18
-rw-r--r--src/nvim/testdir/test_marks.ok6
-rw-r--r--src/nvim/undo.c7
-rw-r--r--src/nvim/version.c2
5 files changed, 32 insertions, 2 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index db8547753d..2d3dc98137 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -28,6 +28,7 @@ SCRIPTS := \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
+ test_marks.out \
NEW_TESTS = test_increment.res
diff --git a/src/nvim/testdir/test_marks.in b/src/nvim/testdir/test_marks.in
new file mode 100644
index 0000000000..341f3ac30f
--- /dev/null
+++ b/src/nvim/testdir/test_marks.in
@@ -0,0 +1,18 @@
+Tests for marks.
+
+STARTTEST
+:so small.vim
+:" test that a deleted mark is restored after delete-undo-redo-undo
+:/^\t/+1
+:set nocp viminfo+=nviminfo
+madduu
+:let a = string(getpos("'a"))
+:$put ='Mark after delete-undo-redo-undo: '.a
+:/^\t/,$wq! test.out
+ENDTEST
+
+ textline A
+ textline B
+ textline C
+
+Results:
diff --git a/src/nvim/testdir/test_marks.ok b/src/nvim/testdir/test_marks.ok
new file mode 100644
index 0000000000..dd1a3e43b5
--- /dev/null
+++ b/src/nvim/testdir/test_marks.ok
@@ -0,0 +1,6 @@
+ textline A
+ textline B
+ textline C
+
+Results:
+Mark after delete-undo-redo-undo: [0, 15, 2, 0]
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 6b60f95f22..b8cdffcda0 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -2222,12 +2222,17 @@ static void u_undoredo(int undo)
/*
* restore marks from before undo/redo
*/
- for (i = 0; i < NMARKS; ++i)
+ for (i = 0; i < NMARKS; ++i) {
if (curhead->uh_namedm[i].mark.lnum != 0) {
free_fmark(curbuf->b_namedm[i]);
curbuf->b_namedm[i] = curhead->uh_namedm[i];
+ }
+ if (namedm[i].mark.lnum != 0) {
curhead->uh_namedm[i] = namedm[i];
+ } else {
+ curhead->uh_namedm[i].mark.lnum = 0;
}
+ }
if (curhead->uh_visual.vi_start.lnum != 0) {
curbuf->b_visual = curhead->uh_visual;
curhead->uh_visual = visualinfo;
diff --git a/src/nvim/version.c b/src/nvim/version.c
index fbb20ad854..95400e66e9 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -523,7 +523,7 @@ static int included_patches[] = {
637,
636,
635,
- // 634,
+ 634,
633,
// 632 NA
631,