commit 50106266bc6fa83c2d141e3f7b44d62df2adc84c
parent ba093b0b48c73a2d776ec98736249712f5105c71
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 21 Oct 2021 12:27:22 +0200
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.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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;