undo: actually enable undoing/redoing an alternative spellcheck

Make sure the inserts of the spell-checked text are undoable, and no
longer discard the undo stack after running the alternate spell checker.
master
David Lawrence Ramsey 2018-07-30 17:07:43 -05:00 committed by Benno Schulenberg
parent 115f089d5f
commit c39c9c241b
2 changed files with 3 additions and 9 deletions

View File

@ -540,7 +540,7 @@ void replace_buffer(const char *filename)
cutbuffer = was_cutbuffer;
/* Insert the processed file into its place. */
read_file(f, descriptor, filename, FALSE);
read_file(f, descriptor, filename, TRUE);
#ifndef NANO_TINY
add_undo(COUPLE_END);
@ -577,7 +577,7 @@ void replace_marked_buffer(const char *filename)
cutbuffer = was_cutbuffer;
/* Insert the processed file where the marked text was. */
read_file(f, descriptor, filename, FALSE);
read_file(f, descriptor, filename, TRUE);
/* Restore the magicline behavior now that we're done fiddling. */
if (!old_no_newlines)

View File

@ -2906,14 +2906,8 @@ const char *do_alt_speller(char *tempfile_name)
/* Stat the temporary file again, and mark the buffer as modified only
* if this file was changed since it was written. */
stat(tempfile_name, &spellfileinfo);
if (spellfileinfo.st_mtime != timestamp) {
if (spellfileinfo.st_mtime != timestamp)
set_modified();
#ifndef NANO_TINY
/* Flush the undo stack, to avoid making a mess when the user
* tries to undo things in spell-corrected lines. */
discard_until(NULL, openfile, FALSE);
#endif
}
#ifndef NANO_TINY
/* Unblock SIGWINCHes again. */