Hello,

to reproduce this:

    Edit a text with a few lines. (This does not work on only one line, as a
    buffer must contain at least one line, and the mark won't be deleted.)

        textline A
        textline B
        textline C

    Navigate to the second line and set a named mark, for example with 'ma'.
    Then delete the line with the mark ('dd'). The mark is gone:

        :marks a
        E283: No marks matching "a"

    Undo the deletion ('u') and check that the mark is there again:

        :marks a
        mark line  col file/text
         a      2    5 textline B

    Redo the deletion ('CTRL-R'). The mark is gone again.
    Undo the deletion again. The mark remains gone.

The problem is that the undo/redo code only saves a mark from the current
buffer when the undo/redo node already contains a valid saved mark of that
name.

The patch below fixes this.


diff -r eaf81729ef02 src/undo.c
--- a/src/undo.c        Tue Feb 10 20:03:46 2015 +0100
+++ b/src/undo.c        Sun Feb 15 03:40:39 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;

Cheers,

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui