From 015c434be1d3741430a6205f3df43062c268cf1a Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 4 Jul 2006 23:03:59 +0000
Subject: [PATCH] cosmetic fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3735 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/browser.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/browser.c b/src/browser.c
index a8042bbd..8e92d07c 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -92,7 +92,7 @@ char *do_browser(char *path, DIR *dir)
     titlebar(path);
 
     while (!abort) {
-	size_t fileline;
+	size_t fileline = (width != 0) ? selected / width : selected;
 		/* The line number the selected file is on. */
 	size_t old_selected = selected;
 		/* The selected file we had before the current selected
@@ -112,12 +112,6 @@ char *do_browser(char *path, DIR *dir)
 	    prev_dir = NULL;
 	}
 
-	/* Calculate the line number we're on now, so that we don't
-	 * divide by zero. */
-	fileline = selected;
-	if (width != 0)
-	    fileline /= width;
-
 	switch (kbinput) {
 #ifndef DISABLE_MOUSE
 	    case KEY_MOUSE:
@@ -192,7 +186,7 @@ char *do_browser(char *path, DIR *dir)
 	    case NANO_NEXTPAGE_KEY:
 		selected += (editwinrows - fileline % editwinrows) *
 			width;
-		if (selected >= filelist_len)
+		if (selected > filelist_len - 1)
 		    selected = filelist_len - 1;
 		break;
 	    case NANO_FIRSTFILE_ALTKEY:
-- 
GitLab