From 51adf02d3424bad91ca33da227724d8c05e2aac4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 14 May 2021 10:12:06 +0200 Subject: [PATCH] wrapping: when copying the quoting part, adjust the file size accordingly Simply adding the number of bytes in the quoting part is not entirely correct, but... currently the indenting and commenting routines also assume that the whitespace and commenting characters that are added or removed are single-byte characters... It will require another patch to make this all fully correct, but for the default configuration (and probably most other cases) the current fix will work fine. This fixes https://savannah.gnu.org/bugs/?60605. Bug existed since version 4.4, commit 8fce33af from two years ago, since this automatic copying of the quoting part was introduced. --- src/text.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/text.c b/src/text.c index 24e0ae79..0d4dbda1 100644 --- a/src/text.c +++ b/src/text.c @@ -1332,6 +1332,7 @@ bool do_wrap(void) strncpy(line->data, line->prev->data, lead_len); openfile->current_x += lead_len; + openfile->totsize += lead_len; #ifndef NANO_TINY free(openfile->undotop->strdata); update_undo(ENTER);