Hi Bram,

On Sat, Jan 12, 2019 at 1:58 PM Bram Moolenaar <[email protected]> wrote:
>
>
> Yegappan wrote:
>
> > > > > > When a line with a sign is deleted, the sign is moved to the
> > > > > > next line. If you undo the delete operation, the sign is not
> > > > > > moved back to the original line.
> > > > > >
> > > > > > I expected that when a line with a sign is deleted, the sign
> > > > > > will be removed. If you undo the delete the operation, the
> > > > > > sign will be restored. This is how the named marks work.
> > > > > > The current undo code handles the named marks correctly
> > > > > > but doesn't handle signs.
> > > > >
> > > > > One of the uses of signs is displaying a breakpoint.  When a line is
> > > > > deleted, the breakpoint still exists.  Displaying it on the next line
> > > > > does seem like the best way to handle this.
> > > > >
> > > > > When undo-ing the delete ideally the sign is moved back to where it 
> > > > > was.
> > > > > But this is quite complicated, it would require the undo information 
> > > > > to
> > > > > contain data about the moved sign.  I don't mind much about the sign
> > > > > being displayed in the wrong line (the debugger with the executable is
> > > > > already not in sync with the source code anyway).  I do mind about the
> > > > > sign not being displayed at all, it looks like the breakpoint was
> > > > > removed, while it wasn't.
> > > > >
> > > >
> > > > It will be useful to add a note to sign.txt about this behavior.
> > > >
> > > > When a line with a sign is deleted, the sign is moved to the next line.
> > >
> > > Let me add this:
> > >
> > > When the line on which the sign is placed is deleted, the sign is moved 
> > > to the
> > > next line (or the last line of the buffer, if there is no next line).  
> > > When
> > > the delete is undone the sign does not move back.
> > >
> > >
> > > However, when I try it, deleting the lines at the end of the buffer, the
> > > sign disappears.  I suppose it's now on a line below the last one.  When
> > >
> >
> > Yes. When you delete the last line, the sign gets moved to the next
> > line below the last line (which is not there).
> >
> > >
> > > undoing the delete the sign is still there, but it's not displayed until
> > >
> >
> > When you undo the delete operation, as the sign line number has
> > already changed, it is not restored back to the last line..
> >
> > > reloading the file.  Can you look into fixing that?  I don't really care
> > > where the sign goes, but reloading the buffer should not be needed.
> >
> > When adjusting the line number of a sign (after a delete operation),
> > if it goes over the last line, we can limit it to the last line in the 
> > buffer.
> > The downside with this approach is that, if multiple lines with signs
> > are deleted at the end of a buffer, then multiple signs will be placed
> > on the same line. What do you think about this approach?
>
> Thanks for looking into this.  I think it's fine if the signs are moved
> to the last line.  They will not be valid anyway and making them
> invisible seems worse.
>

I created pull request #3798 with a slightly different approach.
If a sign is after the last line in the buffer, then the line number
of the sign is not updated. This preserves the sign line number
and restores it across a delete/undo operation.

- Yegappan

-- 
-- 
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