From d66ea08473b60b86803fa1e0439ba5f08ca37186 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 18 Oct 2016 11:46:15 +0200
Subject: [PATCH] moving: adjust the Y position to correspond with the changed
 X position

So the softwrap code in do_down() can compute the correct amount to scroll.

This fixes https://savannah.gnu.org/bugs/?49374.
---
 src/move.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/move.c b/src/move.c
index 8d33b755..533abaf5 100644
--- a/src/move.c
+++ b/src/move.c
@@ -582,8 +582,13 @@ void do_right(void)
     if (openfile->current->data[openfile->current_x] != '\0')
 	openfile->current_x = move_mbright(openfile->current->data,
 						openfile->current_x);
-    else if (openfile->current != openfile->filebot)
+    else if (openfile->current != openfile->filebot) {
 	openfile->current_x = 0;
+#ifndef NANO_TINY
+	if (ISSET(SOFTWRAP))
+	    openfile->current_y -= strlenpt(openfile->current->data) / COLS;
+#endif
+    }
 
     openfile->placewewant = xplustabs();
 
-- 
GitLab