aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-04-27 07:30:14 +0200
committerMarc André Tanner <mat@brain-dump.org>2020-04-27 08:08:02 +0200
commit348cf46dcbca5fecb342b59144a3ef6b36c3c857 (patch)
tree61dd889b1d3317a6bbe976aa3ce844057968adbf
parent4f05ef109fd54a903bd8c28a77d1ac2b56ed8289 (diff)
downloadvis-348cf46dcbca5fecb342b59144a3ef6b36c3c857.tar.gz
vis-348cf46dcbca5fecb342b59144a3ef6b36c3c857.tar.xz
vt100: use shorter escape sequence to clear screen
Instead of clearing the whole screen and then moving the cursor to the home position, we can first move it there and then clear everything below it.
-rw-r--r--ui-terminal-vt100.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-terminal-vt100.c b/ui-terminal-vt100.c
index 3ef2740..12e647d 100644
--- a/ui-terminal-vt100.c
+++ b/ui-terminal-vt100.c
@@ -108,8 +108,8 @@ static void ui_vt100_blit(UiTerm *tui) {
CellColor fg = CELL_COLOR_DEFAULT, bg = CELL_COLOR_DEFAULT;
int w = tui->width, h = tui->height;
Cell *cell = tui->cells;
- /* erase screen, reposition cursor, reset attributes */
- buffer_append0(buf, "\x1b[2J" "\x1b[H" "\x1b[0m");
+ /* reposition cursor, erase screen, reset attributes */
+ buffer_append0(buf, "\x1b[H" "\x1b[J" "\x1b[0m");
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
CellStyle *style = &cell->style;