Module Name:    src
Committed By:   blymn
Date:           Wed Nov 30 06:19:16 UTC 2022

Modified Files:
        src/lib/libcurses: refresh.c

Log Message:
When performing a scroll, check the last line of the region is the same
on virtscr and curscr because the indexes past are supposed to be
one *past* the last matching line (they may actually match if the line is
at the bottom of the screen).  Iff they don't match reduce the scroll
region size by one so we don't scroll non-matching lines, also check
if the region is then 0 after the decrement and just return if it was.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/lib/libcurses/refresh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/refresh.c
diff -u src/lib/libcurses/refresh.c:1.124 src/lib/libcurses/refresh.c:1.125
--- src/lib/libcurses/refresh.c:1.124	Wed Oct 19 06:09:27 2022
+++ src/lib/libcurses/refresh.c	Wed Nov 30 06:19:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.124 2022/10/19 06:09:27 blymn Exp $	*/
+/*	$NetBSD: refresh.c,v 1.125 2022/11/30 06:19:15 blymn Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c	8.7 (Berkeley) 8/13/94";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.124 2022/10/19 06:09:27 blymn Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.125 2022/11/30 06:19:15 blymn Exp $");
 #endif
 #endif				/* not lint */
 
@@ -1852,6 +1852,13 @@ scrolln(int starts, int startw, int curs
 	ox = curscr->curx;
 	n = starts - startw;
 
+	if (!lineeq(__virtscr->alines[startw]->line,
+	    curscr->alines[starts]->line, (size_t) __virtscr->maxx))
+		n--;
+
+	if (n == 0)
+		return;
+
 	/*
 	 * XXX
 	 * The initial tests that set __noqch don't let us reach here unless

Reply via email to