1
1

Discarding 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.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
Benno Schulenberg 2015-12-03 09:03:45 +00:00
родитель ee5cdcbce5
Коммит 8651fefc68
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -1,6 +1,9 @@
2015-12-03 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (discard_until): Move the trimming of the undo stack
into a separate function, so it can be used elsewhere.
* 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.
2015-12-02 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/python.nanorc: Don't colour triple quotes by themselves.

Просмотреть файл

@ -912,7 +912,7 @@ void discard_until(undo *thisone)
while (dropit != NULL && dropit != thisone) {
openfile->undotop = dropit->next;
free(dropit->strdata);
if (dropit->cutbuffer)
if (dropit->cutbuffer != NULL)
free_filestruct(dropit->cutbuffer);
free(dropit);
dropit = openfile->undotop;
@ -2315,8 +2315,14 @@ void do_justify(bool full_justify)
edit_refresh_needed = TRUE;
}
} else {
/* Put the keystroke back into the queue. */
unget_kbinput(kbinput, meta_key, func_key);
/* Throw away the entire undo stack, to prevent a crash when
* the user tries to undo something in the justified text. */
discard_until(NULL);
openfile->current_undo = NULL;
/* Blow away the text in the justify buffer. */
free_filestruct(jusbuffer);
jusbuffer = NULL;