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.
master
Benno Schulenberg 2019-04-20 19:57:43 +02:00
parent 4e52c75568
commit 297fb013cb
1 changed files with 2 additions and 1 deletions

View File

@ -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);