nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 6fa81ca5b8258b6aafb4963957ea20bc82b5e286
parent 4940b02ae016f176ca79f56d4fa4154080922d6d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun,  2 Aug 2020 17:28:09 +0200

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.

Diffstat:
Msrc/text.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -2922,6 +2922,8 @@ void do_formatter(void) return; } + openfile->mark = NULL; + temp_name = safe_tempfile(&stream); if (temp_name != NULL)