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
master
Benno Schulenberg 2015-12-03 09:17:06 +00:00
parent 8651fefc68
commit 4bc8ff1e6d
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,9 @@
* src/text.c (do_justify): Discard the entire undo stack, to prevent * src/text.c (do_justify): Discard the entire undo stack, to prevent
nano from dying (or making mistakes) when trying to undo edits after nano from dying (or making mistakes) when trying to undo edits after
a justification. This works around Savannah bug #45531. 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> 2015-12-02 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/python.nanorc: Don't colour triple quotes by themselves. * doc/syntax/python.nanorc: Don't colour triple quotes by themselves.

View File

@ -394,6 +394,11 @@ void do_indent(ssize_t cols)
free(line_indent); free(line_indent);
if (indent_changed) { 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. */ /* Mark the file as modified. */
set_modified(); set_modified();