nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pasting: when less than a line is pasted, allow automatic hard-w


From: Benno Schulenberg
Subject: [PATCH] pasting: when less than a line is pasted, allow automatic hard-wrapping
Date: Thu, 21 Oct 2021 14:41:43 +0200

When --breaklonglines is in effect and ^U pasted just a short text
(anything that does not contain a newline), then act as if the short
text had been typed 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 98c9aa85..2d74518a 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;
-- 
2.29.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]