Correct linefeed handling when scroll region set (#855)

Linefeeds should only move the cursor down if it's before the end of
the scroll region.

The "out of bounds" panic was triggered by linefeeds going off the
bottom of the screen when the scroll region end was above the cursor.

Note: https://vt100.net/docs/vt102-ug/chapter5.html
"Characters added outside the scrolling region do not cause the screen to scroll."
This commit is contained in:
Yan authored and Joe Wilm committed 2017-11-11 09:23:43 -08:00
1 parent 0bae7ae722
commit d52e545db3
1 file changed
+3 -1
+3 -1
View File
@@ -1452,7 +1452,9 @@ impl ansi::Handler for Term {
if (self.cursor.point.line + 1) == self.scroll_region.end {
self.scroll_up(Line(1));
} else {
self.cursor.point.line += 1;
if (self.cursor.point.line + 1) < self.scroll_region.end {
self.cursor.point.line += 1;
}
}
}