nano-devel
[Top][All Lists]
Advanced

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

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


From: David Ramsey
Subject: Re: [Nano-devel] pasting into a line deletes its bookmark
Date: Wed, 26 Dec 2018 22:00:25 -0600

Marco Diego Aurélio Mesquita:
> A simpler approach 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.
>
> One 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
> behaviour?

I'm not certain how to hook it up to the undo system, but I can fill you
in on some details of how things work, which might help you.

Several of the line splitting/joining functions are small enough to be
handled on their own: do_enter() and do_deletion().  do_delete() and
do_backspace() are both wrappers around do_deletion().

However, most of the line splitting/joining functions are complex enough
to be handled, directly or indirectly, via extract_buffer() (high-level
generic cut) and ingraft_buffer() (high-level generic paste).  Some of
them are handled via nano's ordinary cutting and pasting functions, but
those are just wrappers around the high-level generic functions.
Inserting a file also uses the high-level generic functions.

A few advanced text-altering functions also use the high-level generic
functions at some level in order to be undoable.  For the purposes of
undo, an alternate spell-check is really a cut (of the original text)
followed by an insert (of the spell-checked text), and a justify is
really a cut (of the original text) followed by a paste (of the
justified text).

In short, most of the functions use the same code at the lowest level:
extract_buffer() and ingraft_buffer().  I'd suggest looking in or around
those if you want to add hooks for bookmark handling.



reply via email to

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