nano

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

commit 297fb013cb18bcceb15366c7877880a5ce0299e2
parent 4e52c75568e1f179cbe0c416db2553b39fc1253c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 20 Apr 2019 19:57:43 +0200

wrapping: trim any trailing blanks when cursor goes to next line

When typing a space causes both the succeeding word and the cursor to
be pushed to the next line, then this space (and any contiguous ones)
does need to be snipped (when --trimblanks is in effect).

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

Bug existed since version 2.9.3, commit 91073be4.

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

diff --git a/src/text.c b/src/text.c @@ -1505,7 +1505,8 @@ bool do_wrap(void) size_t tail_x = move_mbleft(line->data, wrap_loc); size_t typed_x = move_mbleft(line->data, cursor_x); - while (tail_x != typed_x && is_blank_mbchar(line->data + tail_x)) { + while ((tail_x != typed_x || cursor_x >= wrap_loc) && + is_blank_mbchar(line->data + tail_x)) { openfile->current_x = tail_x; do_delete(); tail_x = move_mbleft(line->data, tail_x);