On 15-Feb-15, Bram Moolenaar wrote:
> If you have some time, it's always good to have a test that checks the
> problem is fixed.

This did not seem to fit well into any existing test. So I wrote a
test_marks.in, which can also be a place to add more tests for marks.


diff -r eaf81729ef02 src/Makefile
--- a/src/Makefile      Tue Feb 10 20:03:46 2015 +0100
+++ b/src/Makefile      Tue Feb 17 06:40:57 2015 +0100
@@ -1902,6 +1902,7 @@
        test_listlbr \
        test_listlbr_utf8 \
        test_mapping \
+       test_marks \
        test_options \
        test_qf_title \
        test_signs \
diff -r eaf81729ef02 src/testdir/Make_amiga.mak
--- a/src/testdir/Make_amiga.mak        Tue Feb 10 20:03:46 2015 +0100
+++ b/src/testdir/Make_amiga.mak        Tue Feb 17 06:40:57 2015 +0100
@@ -48,6 +48,7 @@
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
+               test_marks.out \
                test_nested_function.out \
                test_options.out \
                test_qf_title.out \
@@ -188,6 +189,7 @@
 test_listlbr.out: test_listlbr.in
 test_listlbr_utf8.out: test_listlbr_utf8.in
 test_mapping.out: test_mapping.in
+test_marks.out: test_marks.in
 test_nested_function.out: test_nested_function.in
 test_options.out: test_options.in
 test_qf_title.out: test_qf_title.in
diff -r eaf81729ef02 src/testdir/Make_dos.mak
--- a/src/testdir/Make_dos.mak  Tue Feb 10 20:03:46 2015 +0100
+++ b/src/testdir/Make_dos.mak  Tue Feb 17 06:40:57 2015 +0100
@@ -47,6 +47,7 @@
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
+               test_marks.out \
                test_nested_function.out \
                test_options.out \
                test_qf_title.out \
diff -r eaf81729ef02 src/testdir/Make_ming.mak
--- a/src/testdir/Make_ming.mak Tue Feb 10 20:03:46 2015 +0100
+++ b/src/testdir/Make_ming.mak Tue Feb 17 06:40:57 2015 +0100
@@ -69,6 +69,7 @@
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
+               test_marks.out \
                test_nested_function.out \
                test_options.out \
                test_qf_title.out \
diff -r eaf81729ef02 src/testdir/Make_os2.mak
--- a/src/testdir/Make_os2.mak  Tue Feb 10 20:03:46 2015 +0100
+++ b/src/testdir/Make_os2.mak  Tue Feb 17 06:40:57 2015 +0100
@@ -49,6 +49,7 @@
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
+               test_marks.out \
                test_nested_function.out \
                test_options.out \
                test_qf_title.out \
diff -r eaf81729ef02 src/testdir/Make_vms.mms
--- a/src/testdir/Make_vms.mms  Tue Feb 10 20:03:46 2015 +0100
+++ b/src/testdir/Make_vms.mms  Tue Feb 17 06:40:57 2015 +0100
@@ -108,6 +108,7 @@
         test_listlbr.out \
         test_listlbr_utf8.out \
         test_mapping.out \
+        test_marks.out \
         test_nested_function.out \
         test_options.out \
         test_qf_title.out \
diff -r eaf81729ef02 src/testdir/Makefile
--- a/src/testdir/Makefile      Tue Feb 10 20:03:46 2015 +0100
+++ b/src/testdir/Makefile      Tue Feb 17 06:40:57 2015 +0100
@@ -45,6 +45,7 @@
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
+               test_marks.out \
                test_nested_function.out \
                test_options.out \
                test_qf_title.out \
diff -r eaf81729ef02 src/testdir/test_marks.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/test_marks.in Tue Feb 17 06:40:57 2015 +0100
@@ -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
+maddu u
+: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 -r eaf81729ef02 src/testdir/test_marks.ok
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/test_marks.ok Tue Feb 17 06:40:57 2015 +0100
@@ -0,0 +1,6 @@
+       textline A
+       textline B
+       textline C
+
+Results:
+Mark after delete-undo-redo-undo: [0, 15, 2, 0]
diff -r eaf81729ef02 src/undo.c
--- a/src/undo.c        Tue Feb 10 20:03:46 2015 +0100
+++ b/src/undo.c        Tue Feb 17 06:40:57 2015 +0100
@@ -2847,11 +2847,14 @@
      * restore marks from before undo/redo
      */
     for (i = 0; i < NMARKS; ++i)
+    {
        if (curhead->uh_namedm[i].lnum != 0)
-       {
            curbuf->b_namedm[i] = curhead->uh_namedm[i];
+       if (namedm[i].lnum != 0)
            curhead->uh_namedm[i] = namedm[i];
-       }
+       else
+           curhead->uh_namedm[i].lnum = 0;
+    }
     if (curhead->uh_visual.vi_start.lnum != 0)
     {
        curbuf->b_visual = curhead->uh_visual;

-- 
Olaf Dabrunz <oda <at> fctrace.org>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to