From 626341635537899f73b369d444bfea1b9d7c1cb7 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 7 Dec 2016 12:33:25 -0600
Subject: [PATCH] moving: always account for the margin when in line numbering
 mode

Like do_down() does already, do_pageup() and do_right() should use
editwincols instead of COLS.

This addresses https://savannah.gnu.org/bugs/?49796.
---
 src/move.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/move.c b/src/move.c
index d621e29e..e9135378 100644
--- a/src/move.c
+++ b/src/move.c
@@ -81,7 +81,7 @@ void do_page_up(void)
 	openfile->current = openfile->current->prev;
 #ifndef NANO_TINY
 	if (ISSET(SOFTWRAP) && openfile->current) {
-	    skipped += strlenpt(openfile->current->data) / COLS;
+	    skipped += strlenpt(openfile->current->data) / editwincols;
 #ifdef DEBUG
 	    fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %lu\n",
 			i, skipped, (long)openfile->current->lineno, (unsigned long)strlenpt(openfile->current->data));
@@ -593,7 +593,7 @@ void do_right(void)
 	openfile->current_x = 0;
 #ifndef NANO_TINY
 	if (ISSET(SOFTWRAP))
-	    openfile->current_y -= strlenpt(openfile->current->data) / COLS;
+	    openfile->current_y -= strlenpt(openfile->current->data) / editwincols;
 #endif
     }
 
-- 
GitLab