formatter: force the mark off, to not crash by accessing empty cutbuffer

More generally, after invoking the formatter, the entire buffer should
be cut (to be replaced with the reformatted text) and not just the part
before the mark, because then everything after it would be duplicated.

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

Bug existed since version 4.9, commit 19517fc5.
master
Benno Schulenberg 2020-08-02 17:28:09 +02:00
parent 4940b02ae0
commit 6fa81ca5b8
1 changed files with 2 additions and 0 deletions

View File

@ -2922,6 +2922,8 @@ void do_formatter(void)
return;
}
openfile->mark = NULL;
temp_name = safe_tempfile(&stream);
if (temp_name != NULL)