Collect sequences of printable ASCII characters and process them

together instead of handling them one by one. This is significantly
faster. Sequences are terminated when we reach the end of the line, fill
the internal buffer, or a different character is seen by the input
parser (an escape sequence, or UTF-8).

Rather than writing collected sequences out immediately, hold them until
it is necessary (another screen modification, or we consume all
available data). This means we can discard changes that would have no
effect (for example, lines that would just be scrolled off the screen or
cleared). This reduces the total amount of data we write out to the
terminal - not important for fast terminals, but a big help with slow
(like xterm).
This commit is contained in:
nicm
2017-02-08 16:45:18 +00:00
parent d4b006b9fa
commit 13a0b6bb3f
7 changed files with 319 additions and 187 deletions

View File

@ -45,6 +45,15 @@ grid_view_set_cell(struct grid *gd, u_int px, u_int py,
grid_set_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py), gc);
}
/* Set cells. */
void
grid_view_set_cells(struct grid *gd, u_int px, u_int py,
const struct grid_cell *gc, const char *s, size_t slen)
{
grid_set_cells(gd, grid_view_x(gd, px), grid_view_y(gd, py), gc, s,
slen);
}
/* Clear into history. */
void
grid_view_clear_history(struct grid *gd, u_int bg)