From 348cf46dcbca5fecb342b59144a3ef6b36c3c857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 27 Apr 2020 07:30:14 +0200 Subject: 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. --- ui-terminal-vt100.c | 4 ++-- 1 file 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; -- cgit v1.2.3