From 50106266bc6fa83c2d141e3f7b44d62df2adc84c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 21 Oct 2021 12:27:22 +0200 Subject: [PATCH] pasting: when less than a line is pasted, allow automatic hard-wrapping When --breaklonglines is in effect and the user pasted just a few words (anything without a linebreak), then act as if this short text had been typed by the user and hard-wrap the line when it became overlong. This fulfills https://savannah.gnu.org/bugs/?61353. --- src/cut.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cut.c b/src/cut.c index 3ce07f0c..06025112 100644 --- a/src/cut.c +++ b/src/cut.c @@ -728,6 +728,10 @@ void paste_text(void) update_undo(PASTE); #endif + /* When still on the same line and doing hard-wrapping, limit the width. */ + if (openfile->current == was_current && ISSET(BREAK_LONG_LINES)) + do_wrap(); + /* If we pasted less than a screenful, don't center the cursor. */ if (less_than_a_screenful(was_lineno, was_leftedge)) focusing = FALSE;