Skip to content

Commit 59dc473

Browse files
committed
Support \t.
Also handle big off-screen cursor positions.
1 parent 3d0de2c commit 59dc473

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/vgaconsole.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,11 @@ impl ConsoleInner {
199199
/// We defer this so you can write the last char on the last line without
200200
/// causing it to scroll pre-emptively.
201201
fn scroll_as_required(&mut self) {
202-
assert!(self.row <= self.height);
203-
if self.col >= self.width {
204-
self.col = 0;
202+
while self.col >= self.width {
203+
self.col -= self.width;
205204
self.row += 1;
206205
}
207-
if self.row == self.height {
206+
while self.row >= self.height {
208207
self.row -= 1;
209208
self.scroll_page();
210209
}
@@ -507,6 +506,9 @@ impl vte::Perform for ConsoleInner {
507506
b'\r' => {
508507
self.col = 0;
509508
}
509+
b'\t' => {
510+
self.col = (self.col + 8) & !7;
511+
}
510512
b'\n' => {
511513
self.col = 0;
512514
self.row += 1;

0 commit comments

Comments
 (0)