commit 945a91357ae10d3738e62e151e827cd9d39a9906
parent 27865304d7da65e4638af07c4307aba5a7fd18eb
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sat, 23 Jul 2005 21:06:22 +0000
eliminate still more redundant screen updates in edit_scroll()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2915 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -3519,7 +3519,9 @@ void edit_scroll(updown direction, int nlines)
}
}
- /* Limit nlines to the number of lines in the edit window. */
+ /* Limit nlines to a minimum of the number of lines we could scroll,
+ * and to a maximum of the number of lines in the edit window. */
+ nlines -= i;
if (nlines > editwinrows)
nlines = editwinrows;
@@ -3537,11 +3539,17 @@ void edit_scroll(updown direction, int nlines)
* window. */
if (direction == UP && i > 0 && openfile->edittop ==
openfile->fileage)
- nlines = editwinrows - 2;
+ nlines = editwinrows;
- /* If the lines before and after the scrolled region are visible in
- * the edit window, we need to draw them too. */
- nlines += 2;
+ /* If the scrolled region contains only one line, and the line
+ * before it is visible in the edit window, we need to draw it too.
+ * If the scrolled region contains more than one line, and the lines
+ * before and after the scrolled region are visible in the edit
+ * window, we need to draw them too. */
+ if (nlines == 1)
+ nlines++;
+ else
+ nlines += 2;
if (nlines > editwinrows)
nlines = editwinrows;