[PATCH 3/4] display: for narrow windows, fall back to single-line sidescrolling

Benno Schulenberg <[email protected]> Sun, 18 Jan 2026 10:56:23 +0100
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
Otherwise the cursor can get misplaced sometimes.
---
 src/nano.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/nano.c b/src/nano.c
index 92ebf39f..34379685 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2687,6 +2687,10 @@ int main(int argc, char **argv)
 		if (currmenu != MMAIN)
 			bottombars(MMAIN);
 
+		/* Fall back to single-line sidescrolling when the window is narrow. */
+		if (editwincols < 2 * CUSHION + 2)
+			SET(SOLO_SIDESCROLL);
+
 #ifndef NANO_TINY
 		if (ISSET(MINIBAR) && !ISSET(ZERO) && LINES > 1 && lastmessage < REMARK)
 			minibar();
-- 
2.51.2