[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] pasting into a line deletes its bookmark

From: Marco Diego Aurélio Mesquita
Subject: Re: [Nano-devel] pasting into a line deletes its bookmark
Date: Tue, 18 Dec 2018 12:50:00 -0200
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Dec 18, 2018 at 01:52:03PM +0100, Benno Schulenberg wrote:
> Op 18-12-18 om 02:49 schreef Marco Diego Aurélio Mesquita:
> > It looks like managing bookmarked lines has many corner cases which
> > I overlooked.
> > 
> > To improved the situation, I decided to enumerate some test-cases,
> > found and fixed some bugs.
> I don't think your patch with fixes takes the right approach.
> Instead of looking at and fixing all the different operations,
> I think it should be done simpler: before doing an operation,
> remember whether the current line is bookmarked; and after the
> operation make sure the current line gets the same state --
> except when pasting or inserting something that includes a
> newline.  Probably this should be done at the highest level,
> or somewhere in do_input().

I think you're right. After around 60 test cases I got stuck on how
to correctly undo a line join and could not correctly differentiate
two cases: pressing delete on the line before "b1" and pressing
delete after "b1". By that point the patch already accumulated fixes
for so many cases that I couldn't even remember which they were. A
simpler appoach is needed; even geany is not advanced enough to
handle all undo cases the way I expected. There is no reason to
make it more complex than needed.

On small thing: we should not keep the state of the "current line"
but the state of where the operation was initiated. This will
probably handle undo correctly.

Do you have any hint on where more precisely I should fix this

> Doing things that way would mean that deleting the current line
> leaves the bookmark in place: on the line that is now the current
> line.  I even think that is better behavior: when I plant a flag
> somewhere, I want the flag to keep standing also when I cut away
> some earth around it.  This also means that a bookmark should not
> "travel" into the cutbuffer and does not get "replanted" where
> the cutbuffer gets pasted (and would get replanted multiple times
> if you pasted the cutbuffer multiple times).

I actually like the possibility of cutting and pasting bookmarks. But
if that means added complexity, I can live without it.

> See if that method makes for a simpler fixes patch, because if
> you have to add tens of extra lines to make the bookmarking stuff
> work, I'm not going to accept the whole patch set.

I'll think about a simpler way to do it. Once I have something I'm
happy with I'll talk back.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]