undo: clear the Modified state when the very first edit is undone
This also means that no question needs to be asked when exiting. This fixes https://savannah.gnu.org/bugs/?52504. Reported-by: Peter Passchier <peter@passchier.net>
Этот коммит содержится в:
родитель
73c7f1cbdc
Коммит
0c9905dbd0
@ -100,6 +100,7 @@ void make_new_buffer(void)
|
||||
openfile->undotop = NULL;
|
||||
openfile->current_undo = NULL;
|
||||
openfile->last_action = OTHER;
|
||||
openfile->pristine = TRUE;
|
||||
|
||||
openfile->current_stat = NULL;
|
||||
openfile->lock_filename = NULL;
|
||||
|
@ -396,6 +396,9 @@ typedef struct openfilestruct {
|
||||
/* The current (i.e. next) level of undo. */
|
||||
undo_type last_action;
|
||||
/* The type of the last action the user performed. */
|
||||
bool pristine;
|
||||
/* Whether the undo stack still contains the first edit -- it won't
|
||||
* when a justification or spell check discarded the undo stack. */
|
||||
char *lock_filename;
|
||||
/* The path of the lockfile, if we created one. */
|
||||
#endif
|
||||
|
11
src/text.c
11
src/text.c
@ -865,7 +865,13 @@ void do_undo(void)
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
openfile->totsize = u->wassize;
|
||||
set_modified();
|
||||
|
||||
/* If *everything* was undone, then unset the "Modified" marker. */
|
||||
if (openfile->current_undo == NULL && openfile->pristine) {
|
||||
openfile->modified = FALSE;
|
||||
titlebar(NULL);
|
||||
} else
|
||||
set_modified();
|
||||
}
|
||||
|
||||
/* Redo the last thing(s) we undid. */
|
||||
@ -1207,6 +1213,9 @@ void discard_until(const undo *thisitem, openfilestruct *thefile)
|
||||
|
||||
/* Prevent a chain of editing actions from continuing. */
|
||||
thefile->last_action = OTHER;
|
||||
|
||||
/* Record that the undo stack no longer goes back to the beginning. */
|
||||
thefile->pristine = FALSE;
|
||||
}
|
||||
|
||||
/* Add a new undo struct to the top of the current pile. */
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user