Skip to content

Commit a4be619

Browse files
committed
Fix move cursor esc sequence of terminalio to meet ANSI standard
1 parent 26751c9 commit a4be619

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

shared-module/terminalio/Terminal.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
106106
}
107107
}
108108
if (c == ';') {
109-
int16_t m = 0;
109+
uint16_t m = 0;
110110
for (++j; j < 9; j++) {
111111
if ('0' <= i[j] && i[j] <= '9') {
112112
m = m * 10 + (i[j] - '0');
@@ -116,6 +116,12 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
116116
}
117117
}
118118
if (c == 'H') {
119+
if (n > 0) {
120+
n--;
121+
}
122+
if (m > 0) {
123+
m--;
124+
}
119125
if (n >= self->tilegrid->height_in_tiles) {
120126
n = self->tilegrid->height_in_tiles - 1;
121127
}

0 commit comments

Comments
 (0)