nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] the difficulties of behaving similar


From: Benno Schulenberg
Subject: Re: [Nano-devel] the difficulties of behaving similar
Date: Wed, 18 Jun 2014 14:07:57 +0200

On Wed, Jun 18, 2014, at 7:34, Mark Majeres wrote:
> I didn't find problems in either case.  Toggling the cursor pos w/ M-C
> doesn't break the series for ^K or ^C.  Also, if preserve is set to
> FALSE when a toggle is detected, then M-C breaks the series for both
> ^K and ^C.

Yeah, you're right.  Don't know what I did wrong.  :|
(Probably forgot to run make once after fiddling back
and forth with your patch.)

> The cutbuffer_reset() in add_undo() is the most important one, it
> needs to stay there.

Well... in the current situation, that cutbuffer_reset() only gets
called when either the mark is set OR the cutbuffer has already
been reset.  The latter is unneeded, and for the former... wouldn't
it be enough to do the call in do_cut_text(), like I proposed earlier?

You see, to me it doesn't feel right that the undo/redo code makes
a call to cutbuffer_reset(), it is the cutting and copying code that
should do that.  Please see attached revised version of your patch.


> The function add_undo is called *before* the text is cut or pasted.
> add_undo() just creates a new undo object and prepares it.  After the
> operation has completed, update_undo() is called and the undo object
> is filled with the cutbuffer contents.  [...]
> 
> The call to add_undo(CUT) will return early if the cut_buffer is to be
> preserved, else a new undo is added, and a new series is started. When
> a new series starts, the cutbuffer needs to be empty, thus the
> importance of having cutbuffer_reset() in add_undo().  The call is
> often redundant, as the buffer may have been reset by other keystrokes
> already, but it *always* needs to be done in preparation for a new
> series of cuts.
> 
> The copy operation does not require an undo, so a check similar to the
> one performed in add_undo(CUT) is performed inside the do_copy_text()
> function.

Thanks for the explanations.  That helped.

Benno

-- 
http://www.fastmail.fm - One of many happy users:
  http://www.fastmail.fm/help/overview_quotes.html

Attachment: newercutbuffer.patch
Description: Text Data


reply via email to

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