10000 -1 in uint8_t caused ESC[H to clear to line end by bill88t · Pull Request #10112 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

-1 in uint8_t caused ESC[H to clear to line end #10112

New issue

8000 Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions shared-module/terminalio/Terminal.c
740F
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
}
} else if (c == 0x1b) {
// Handle commands of the form [ESC].<digits><command-char> where . is not yet known.
uint8_t vt_args[3] = {0, -1, -1};
uint8_t vt_args[3] = {0, 0, 0};
uint8_t j = 1;
#if CIRCUITPY_TERMINALIO_VT100
uint8_t n_args = 1;
Expand Down Expand Up @@ -188,18 +188,17 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
if (vt_args[0] > 0) {
vt_args[0]--;
}
if (vt_args[1] == -1) {
vt_args[1] = 0;
}
if (vt_args[1] > 0) {
vt_args[1]--;
}

if (vt_args[0] >= self->scroll_area->height_in_tiles) {
vt_args[0] = self->scroll_area->height_in_tiles - 1;
}
if (vt_args[1] >= self->scroll_area->width_in_tiles) {
vt_args[1] = self->scroll_area->width_in_tiles - 1;
}

vt_args[0] = (vt_args[0] + self->scroll_area->top_left_y) % self->scroll_area->height_in_tiles;
self->cursor_x = vt_args[1];
self->cursor_y = vt_args[0];
Expand Down
0