[Top][All Lists]

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

Re: [Nano-devel] adding a word-completion feature to nano

From: Benno Schulenberg
Subject: Re: [Nano-devel] adding a word-completion feature to nano
Date: Fri, 11 Nov 2016 19:55:44 +0100

On Wed, Nov 9, 2016, at 20:25, Sumedh Pendurkar wrote:
> On 11/09/16 19:37, Benno Schulenberg wrote:
> > But what does that do?  Discarding until current_undo does
> > nothing, right?
> When we do_undo we would move current_undo back by one. But not actually 
> pop one element off the undo stack i.e. undotop will remain the same. 
> And therefore redo might go wrong as the deletion is still in memory.

I don't think this redo can go /wrong/ -- there will be no error,
or fault, or crash, or whatever.

> It causes error when you complete 1 cycle(i.e. no further matches) and 
> press 'M-E' . which would redo the previous suggestion which is undesirable.

I see what you mean, but... when a cycle completes ("No further
matches"), it feels to me as if the user has "cancelled" the 
completion, and then might think: "Oh, no, I /do/ want that
last proposal" and types M-E to get it.  Yes, probably no one
will think of doing that, but I don't think there is any harm
in leaving the item on the stack -- it will disappear as soon
as the user types something else.

Also, when the user types M-U somewhere halfway the cycle,
they can redo that suggestion with M-E.  The disappearance
of the last suggestion in a cycle feels to me as comparable
to an M-U halfway.

> > How is it possible that a single undo undoes
> > both the line wrap and the attempted completion?  I can't break it,
> > so it must be correct, but it feels like magic.
> I had figured that out when I had sent the patch. But now, it seems like 
> magic to me too. Have to figure that out why that happens.

It happens in add_undo(), where a SPLIT_BEGIN item is not added at
the top of the stack but is inserted /underneath/ the top item
(the item of text insertion that caused the split or linewrap).
That is where the "magic" is.

> (Sorry I cannot look much into the 
> code for a couple of weeks due to examinations)

Okay, no worries, things look fine, and there is no hurry.

> > I've pushed a tweaked version of your patch to the branch.
> > Please verify that you are okay with it.
> Its good. I think we need to add the discard_until..

I don't think it is needed.


-- - The professional email service

reply via email to

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