From 2fa93ae9998900778474206645f2be858ff65f33 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 9 Dec 2016 12:47:00 +0100
Subject: [PATCH] tweaks: rename two variables to make more sense

---
 src/winio.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 7158dd75..06bc5d2f 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2810,21 +2810,22 @@ void compute_maxrows(void)
 {
 #ifndef NANO_TINY
     if (ISSET(SOFTWRAP)) {
-	int n;
-	filestruct *foo = openfile->edittop;
+	int screenrow;
+	filestruct *line = openfile->edittop;
 
 	maxrows = 0;
-	for (n = 0; n < editwinrows && foo; n++) {
+
+	for (screenrow = 0; screenrow < editwinrows && line != NULL; screenrow++) {
+	    screenrow += strlenpt(line->data) / editwincols;
+	    line = line->next;
 	    maxrows++;
-	    n += strlenpt(foo->data) / editwincols;
-	    foo = foo->next;
 	}
 
-	if (n < editwinrows)
-	    maxrows += editwinrows - n;
+	if (screenrow < editwinrows)
+	    maxrows += editwinrows - screenrow;
 
 #ifdef DEBUG
-	fprintf(stderr, "compute_maxrows(): maxrows = %d\n", maxrows);
+	fprintf(stderr, "recomputed: maxrows = %d\n", maxrows);
 #endif
     } else
 #endif /* !NANO_TINY */
-- 
GitLab