vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 92f4c707521055e1be940f2aba6b44d7f887d10e
parent f32ac6aabcba5e0beaf751ac411b189331c02550
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon, 27 Apr 2020 07:30:14 +0200

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.

Diffstat:
Mui-terminal-vt100.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 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;