undo: do not mark the buffer as modified when pasting back nothing

This completes the fix for https://savannah.gnu.org/bugs/?57915.
master
Benno Schulenberg 2020-02-28 13:21:57 +01:00
parent 0568f7a2b6
commit bd88b8b5a6
1 changed files with 4 additions and 1 deletions

View File

@ -669,6 +669,7 @@ void do_redo(void)
{ {
linestruct *line = NULL, *intruder; linestruct *line = NULL, *intruder;
char *data, *redidmsg = NULL; char *data, *redidmsg = NULL;
bool suppress_modification = FALSE;
undostruct *u = openfile->undotop; undostruct *u = openfile->undotop;
if (u == NULL || u == openfile->current_undo) { if (u == NULL || u == openfile->current_undo) {
@ -764,6 +765,8 @@ void do_redo(void)
goto_line_posx(u->head_lineno, u->head_x); goto_line_posx(u->head_lineno, u->head_x);
if (u->cutbuffer) if (u->cutbuffer)
copy_from_buffer(u->cutbuffer); copy_from_buffer(u->cutbuffer);
else
suppress_modification = TRUE;
free_lines(u->cutbuffer); free_lines(u->cutbuffer);
u->cutbuffer = NULL; u->cutbuffer = NULL;
break; break;
@ -814,7 +817,7 @@ void do_redo(void)
if (openfile->current_undo == openfile->last_saved) { if (openfile->current_undo == openfile->last_saved) {
openfile->modified = FALSE; openfile->modified = FALSE;
titlebar(NULL); titlebar(NULL);
} else } else if (!suppress_modification)
set_modified(); set_modified();
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */