[PATCH] display: let --jumpyscrolling affect also the sideways scrolling

Benno Schulenberg <[email protected]> Sun, 8 Feb 2026 12:22:24 +0100
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
When using --jumpy, the viewport scrolls vertically in steps of
half a screen (height).  Then it makes sense that the viewport
also scrolls horizontally in steps of half a screen (width).
---
 src/utils.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/utils.c b/src/utils.c
index 191bf23a..4e251cb5 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -347,9 +347,13 @@ size_t get_page_start(size_t column)
 		if (column < CUSHION)
 			return 0;
 		else if (column < openfile->brink + CUSHION)
-			return column - CUSHION;
+		{	if (ISSET(JUMPY_SCROLLING))
+				return (column > editwincols / 2) ? column - editwincols / 2 : 0;
+			else
+				return column - CUSHION;
+		}
 		else if (column > openfile->brink + editwincols - CUSHION - 1)
-			return column - editwincols + CUSHION + 1;
+			return column - editwincols + (ISSET(JUMPY_SCROLLING) ? editwincols / 2 : CUSHION) + 1;
 		else
 			return openfile->brink;
 	}
-- 
2.51.2