undo: differentiate between general filtering and spell checking

With-help-from: David Lawrence Ramsey <pooka109@gmail.com>
This commit is contained in:
Benno Schulenberg
2018-08-04 09:51:32 +02:00
parent c39c9c241b
commit 667fcea65e
2 changed files with 10 additions and 3 deletions

View File

@@ -523,6 +523,7 @@ void replace_buffer(const char *filename)
#ifndef NANO_TINY #ifndef NANO_TINY
add_undo(COUPLE_BEGIN); add_undo(COUPLE_BEGIN);
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
#endif #endif
/* Throw away the text of the file. */ /* Throw away the text of the file. */
@@ -544,6 +545,7 @@ void replace_buffer(const char *filename)
#ifndef NANO_TINY #ifndef NANO_TINY
add_undo(COUPLE_END); add_undo(COUPLE_END);
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
#endif #endif
} }
@@ -567,6 +569,7 @@ void replace_marked_buffer(const char *filename)
SET(NO_NEWLINES); SET(NO_NEWLINES);
add_undo(COUPLE_BEGIN); add_undo(COUPLE_BEGIN);
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
/* Throw away the text under the mark. */ /* Throw away the text under the mark. */
cutbuffer = NULL; cutbuffer = NULL;
@@ -584,6 +587,7 @@ void replace_marked_buffer(const char *filename)
UNSET(NO_NEWLINES); UNSET(NO_NEWLINES);
add_undo(COUPLE_END); add_undo(COUPLE_END);
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#endif /* ENABLE_SPELLER */ #endif /* ENABLE_SPELLER */

View File

@@ -796,7 +796,7 @@ void do_undo(void)
cutbottom = oldcutbottom; cutbottom = oldcutbottom;
break; break;
case COUPLE_BEGIN: case COUPLE_BEGIN:
undidmsg = _("filtering"); undidmsg = u->strdata;
break; break;
case COUPLE_END: case COUPLE_END:
openfile->current_undo = openfile->current_undo->next; openfile->current_undo = openfile->current_undo->next;
@@ -968,7 +968,7 @@ void do_redo(void)
do_redo(); do_redo();
return; return;
case COUPLE_END: case COUPLE_END:
redidmsg = _("filtering"); redidmsg = u->strdata;
break; break;
case INDENT: case INDENT:
handle_indent_action(u, FALSE, TRUE); handle_indent_action(u, FALSE, TRUE);
@@ -1182,6 +1182,7 @@ bool execute_command(const char *command)
#endif #endif
{ {
add_undo(COUPLE_BEGIN); add_undo(COUPLE_BEGIN);
openfile->undotop->strdata = mallocstrcpy(NULL, _("filtering"));
if (openfile->mark == NULL) { if (openfile->mark == NULL) {
openfile->current = openfile->fileage; openfile->current = openfile->fileage;
openfile->current_x = 0; openfile->current_x = 0;
@@ -1231,8 +1232,10 @@ bool execute_command(const char *command)
else else
read_file(stream, 0, "pipe", TRUE); read_file(stream, 0, "pipe", TRUE);
if (should_pipe && !ISSET(MULTIBUFFER)) if (should_pipe && !ISSET(MULTIBUFFER)) {
add_undo(COUPLE_END); add_undo(COUPLE_END);
openfile->undotop->strdata = mallocstrcpy(NULL, _("filtering"));
}
if (wait(NULL) == -1) if (wait(NULL) == -1)
nperror("wait"); nperror("wait");