commit 7b07e1ee5c18ea7dbdf744ff1cafa2b311ee248a
parent c02aec557c752a98929193db4ea2a236b7c8f25a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 17 Apr 2024 16:35:51 +0200
softwrap: adjust start-of-screen when the 'edittop' line is hard-wrapped
When one or more chunks of the current line are above the viewport,
and this line gets hard-wrapped, then 'edittop' needs to be advanced,
otherwise the first row could be blank -- representing a chunk that
doesn't exist any more.
This fixes https://savannah.gnu.org/bugs/?65604.
The issue was reported by `correctmost`.
Bug existed since version 2.8.6, commit e375995d.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -1339,6 +1339,12 @@ void do_wrap(void)
/* Now split the line. */
do_enter();
+#ifndef NANO_TINY
+ /* When wrapping a partially visible line, adjust start-of-screen. */
+ if (openfile->edittop == line && openfile->firstcolumn > 0 && cursor_x >= wrap_loc)
+ go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn);
+#endif
+
#ifdef ENABLE_JUSTIFY
/* If the original line has quoting, copy it to the spillage line. */
if (quot_len > 0) {