nano

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

commit c4d09cc24ba979e5589d8bd4d6f93f726e60bb7c
parent d04c8f88f1e640d5528dc8cb83c50a79b27b7500
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 22 Jul 2018 09:08:35 +0200

text: add auto-whitespace to the file size after creating the undo item

The undo item for ENTER should record the file size *before* the amount
of auto-indentation whitespace is added to it.

This fixes https://savannah.gnu.org/bugs/?54344.
Reported-by: Liu Hao <lh_mouse@126.com>

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

diff --git a/src/text.c b/src/text.c @@ -1050,8 +1050,6 @@ void do_enter(void) /* If there were only blanks before the cursor, trim them. */ if (allblanks) openfile->current_x = 0; - else - openfile->totsize += extra; } #endif @@ -1081,6 +1079,8 @@ void do_enter(void) set_modified(); #ifndef NANO_TINY + if (ISSET(AUTOINDENT) && !allblanks) + openfile->totsize += extra; update_undo(ENTER); #endif