From 13a0b6bb3fe05454cace81f5ec7624f6fd9021a5 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Feb 2017 16:45:18 +0000 Subject: 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). --- grid-view.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'grid-view.c') diff --git a/grid-view.c b/grid-view.c index da0433bf..b84ac64e 100644 --- a/grid-view.c +++ b/grid-view.c @@ -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) -- cgit