summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/screen.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-02-08 16:45:19 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-02-08 16:45:19 +0000
commitc89ffd9b8d1043bd3bf124090eb45f06a66d976a (patch)
tree2947409282550470407c332a4d8ab42081572894 /usr.bin/tmux/screen.c
parenta867f852aa3f5a75387cfa9de3dddf71592bd763 (diff)
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).
Diffstat (limited to 'usr.bin/tmux/screen.c')
-rw-r--r--usr.bin/tmux/screen.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c
index 22f7390c4a6..3e305ef7c93 100644
--- a/usr.bin/tmux/screen.c
+++ b/usr.bin/tmux/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.45 2016/11/24 13:38:44 nicm Exp $ */
+/* $OpenBSD: screen.c,v 1.46 2017/02/08 16:45:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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. */