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

@ -40,9 +40,6 @@ screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
s->ccolour = xstrdup("");
s->tabs = NULL;
s->dirty = NULL;
s->dirtysize = 0;
screen_reinit(s);
}
@ -69,7 +66,6 @@ screen_reinit(struct screen *s)
void
screen_free(struct screen *s)
{
free(s->dirty);
free(s->tabs);
free(s->title);
free(s->ccolour);
@ -358,7 +354,7 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
xx = sel->sx - 1;
else
xx = sel->sx;
if (py == sel->sy && px > xx)
if (py == sel->sy && (sel->sx == 0 || px > xx))
return (0);
} else {
/* starting line == ending line. */