nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4bc8ff1e6d4550251e9216fe59ff8cbb8ee2b27d
parent 8651fefc68abda94607303f3a33836f51124c25b
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Thu,  3 Dec 2015 09:17:06 +0000

Discarding the entire undo stack, to prevent nano from making mistakes
when trying to undo edits after an indentation change.
This works around Savannah bug #46591.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 3+++
Msrc/text.c | 5+++++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -4,6 +4,9 @@ * src/text.c (do_justify): Discard the entire undo stack, to prevent nano from dying (or making mistakes) when trying to undo edits after a justification. This works around Savannah bug #45531. + * src/text.c (do_indent): Also here discard the entire undo stack, to + prevent nano from making mistakes when trying to undo edits after an + indentation change. This works around Savannah bug #46591. 2015-12-02 Benno Schulenberg <bensberg@justemail.net> * doc/syntax/python.nanorc: Don't colour triple quotes by themselves. diff --git a/src/text.c b/src/text.c @@ -394,6 +394,11 @@ void do_indent(ssize_t cols) free(line_indent); if (indent_changed) { + /* Throw away the undo stack, to prevent making mistakes when + * the user tries to undo something in the reindented text. */ + discard_until(NULL); + openfile->current_undo = NULL; + /* Mark the file as modified. */ set_modified();