nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] Pipe selected text to external tool


From: David Ramsey
Subject: Re: [Nano-devel] [PATCH] Pipe selected text to external tool
Date: Sat, 17 Feb 2018 23:46:11 -0600

Marco Diego Aurélio Mesquita:
> Only inconvenience now is that undo needs two steps: one to undo the
> insertion and another to undo the cut. I don't know what is the best
> way to fix it.

What you're really trying to accomplish here is to treat this two-step
process:

1) Remove text spanning multiple lines.

2) Insert different text spanning multiple lines in the place of the
original text spanning multiple lines.

as one undoable action: multiline text replace.  However, there's no
undo type for that; the existing undo type for text replace only works
within single lines.

Adding an undo type for multiline replace would fix this problem, but it
would not be trivial, and you'd have to avoid using the cutbuffer
routines to do so, since using the cutbuffer routines is what is adding
the separate cuts that you have to undo.  Directly using nano.c's
extract_buffer(), ingraft_buffer(), and/or copy_from_buffer() functions
could accomplish this; look at how the cutbuffer routines use them.

(Notably, if the multiline replace undo type existed, justifying and
unjustifying could be covered by it.  This is because "justify" is
really "remove the unjustified text spanning multiple lines; insert the
justified text spanning multiple lines in the place of the unjustified
text spanning multiple lines".  As long as the justify buffer containing
the unjustified text was saved properly, this would work.)



reply via email to

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