anchor: do not let piping and spelling transfer an anchor to the top

Just let all anchors disappear when doing an external spell check or
formatting or piping the buffer through an external command, because
leaving just a single anchor on the top line is useless.

This fixes https://savannah.gnu.org/bugs/?58273.

Bug existed since commit 732cf887 from one month ago.  That code
causes an anchor to persist at the point where lines are removed.
This commit is contained in:
Benno Schulenberg 2020-04-30 16:47:10 +02:00
parent 11f099e1da
commit 4bdd6013b0
2 changed files with 4 additions and 1 deletions

View File

@ -1057,6 +1057,7 @@ bool execute_command(const char *command)
}
add_undo(CUT, NULL);
do_snip(openfile->mark != NULL, openfile->mark == NULL, FALSE);
openfile->filetop->has_anchor = FALSE;
update_undo(CUT);
}

View File

@ -2446,8 +2446,10 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
openfile->current_x = strlen(openfile->current->data);
#ifndef NANO_TINY
if (replaced)
if (replaced) {
openfile->filetop->has_anchor = FALSE;
update_undo(COUPLE_END);
}
#endif
openfile->placewewant = pww_save;