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.
master
Benno Schulenberg 2021-10-21 12:27:22 +02:00
parent ba093b0b48
commit 50106266bc
1 changed files with 4 additions and 0 deletions

View File

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