Skip to content

Commit f180581

Browse files
committed
-1 in uint8_t caused ESC[H to clear to line end
1 parent bc36b94 commit f180581

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

shared-module/terminalio/Terminal.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
114114
}
115115
} else if (c == 0x1b) {
116116
// Handle commands of the form [ESC].<digits><command-char> where . is not yet known.
117-
uint8_t vt_args[3] = {0, -1, -1};
117+
uint8_t vt_args[3] = {0, 0, 0};
118118
uint8_t j = 1;
119119
#if CIRCUITPY_TERMINALIO_VT100
120120
uint8_t n_args = 1;
@@ -188,18 +188,17 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
188188
if (vt_args[0] > 0) {
189189
vt_args[0]--;
190190
}
191-
if (vt_args[1] == -1) {
192-
vt_args[1] = 0;
193-
}
194191
if (vt_args[1] > 0) {
195192
vt_args[1]--;
196193
}
194+
197195
if (vt_args[0] >= self->scroll_area->height_in_tiles) {
198196
vt_args[0] = self->scroll_area->height_in_tiles - 1;
199197
}
200198
if (vt_args[1] >= self->scroll_area->width_in_tiles) {
201199
vt_args[1] = self->scroll_area->width_in_tiles - 1;
202200
}
201+
203202
vt_args[0] = (vt_args[0] + self->scroll_area->top_left_y) % self->scroll_area->height_in_tiles;
204203
self->cursor_x = vt_args[1];
205204
self->cursor_y = vt_args[0];

0 commit comments

Comments
 (0)