PERFORCE change 155342 for review
    Ed Schouten 
    ed at FreeBSD.org
       
    Sat Dec 27 12:45:06 PST 2008
    
    
  
http://perforce.freebsd.org/chv.cgi?CH=155342
Change 155342 by ed at 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);
 	}
    
    
More information about the p4-projects
mailing list