From 945a91357ae10d3738e62e151e827cd9d39a9906 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 23 Jul 2005 21:06:22 +0000 Subject: [PATCH] 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 --- src/winio.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/winio.c b/src/winio.c index 8ae8964e..a0d8318a 100644 --- 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; -- 2.39.5