Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Dec 2008 20:45:06 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 155342 for review
Message-ID:  <200812272045.mBRKj6Tw094701@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=155342

Change 155342 by ed@ed_dull on 2008/12/27 20:44:49

	Fix crashes when panning up/down too many lines.

Affected files ...

.. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#21 edit

Differences ...

==== //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#21 (text+ko) ====

@@ -96,7 +96,7 @@
 		/* Scroll down. */
 
 		/* Copy existing data up. */
-		if (t->t_scrollreg.ts_end - t->t_scrollreg.ts_begin > amount) {
+		if (t->t_scrollreg.ts_begin + amount < t->t_scrollreg.ts_end) {
 			tr.tr_begin.tp_row = t->t_scrollreg.ts_begin + amount;
 			tr.tr_begin.tp_col = 0;
 			tr.tr_end.tp_row = t->t_scrollreg.ts_end;
@@ -104,6 +104,10 @@
 			tp.tp_row = t->t_scrollreg.ts_begin;
 			tp.tp_col = 0;
 			teken_funcs_copy(t, &tr, &tp);
+
+			tr.tr_end.tp_row = t->t_scrollreg.ts_end - amount;
+		} else {
+			tr.tr_end.tp_row = t->t_scrollreg.ts_begin;
 		}
 
 		/* Clear the last lines. */
@@ -117,7 +121,7 @@
 		amount = -amount;
 
 		/* Copy existing data down. */
-		if (t->t_scrollreg.ts_end - t->t_scrollreg.ts_begin > amount) {
+		if (t->t_scrollreg.ts_begin + amount < t->t_scrollreg.ts_end) {
 			tr.tr_begin.tp_row = t->t_scrollreg.ts_begin;
 			tr.tr_begin.tp_col = 0;
 			tr.tr_end.tp_row = t->t_scrollreg.ts_end - amount;
@@ -125,12 +129,15 @@
 			tp.tp_row = t->t_scrollreg.ts_begin + amount;
 			tp.tp_col = 0;
 			teken_funcs_copy(t, &tr, &tp);
+
+			tr.tr_end.tp_row = t->t_scrollreg.ts_begin + amount;
+		} else {
+			tr.tr_end.tp_row = t->t_scrollreg.ts_end;
 		}
 
 		/* Clear the first lines. */
 		tr.tr_begin.tp_row = t->t_scrollreg.ts_begin;
 		tr.tr_begin.tp_col = 0;
-		tr.tr_end.tp_row = t->t_scrollreg.ts_begin + amount;
 		tr.tr_end.tp_col = t->t_winsize.tp_col;
 		teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812272045.mBRKj6Tw094701>