Sync OpenBSD patchset 1072:

Add a simple form of output rate limiting by counting the number of
certain C0 sequences (linefeeds, backspaces, carriage returns) and if it
exceeds a threshold (current default 50/millisecond), start to redraw
the pane every 100 milliseconds instead of making each change as it
comes. Two configuration options - c0-change-trigger and
c0-change-interval.

This makes tmux much more responsive under very fast output (for example
yes(1) or accidentally cat'ing a large file) but may not be perfect on
all terminals and connections - feedback very welcome, particularly
where this change has a negative rather than positive effect (making it
off by default is a possibility).

After much experimentation based originally on a request Robin Lee
Powell (which ended with a completely different solution), this idea
from discussion with Ailin Nemui.
This commit is contained in:
Tiago Cunha
2012-03-29 21:05:16 +00:00
parent 621fa0a686
commit f9f6eea444
6 changed files with 93 additions and 5 deletions

7
tmux.h
View File

@ -807,6 +807,7 @@ struct window_pane {
int flags;
#define PANE_REDRAW 0x1
#define PANE_DROP 0x2
char *cmd;
char *shell;
@ -815,6 +816,10 @@ struct window_pane {
pid_t pid;
char tty[TTY_NAME_MAX];
u_int changes;
struct event changes_timer;
u_int changes_redraw;
int fd;
struct bufferevent *event;
@ -1959,6 +1964,7 @@ void window_destroy_panes(struct window *);
struct window_pane *window_pane_find_by_id(u_int);
struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int);
void window_pane_destroy(struct window_pane *);
void window_pane_timer_start(struct window_pane *);
int window_pane_spawn(struct window_pane *, const char *,
const char *, const char *, struct environ *,
struct termios *, char **);
@ -1977,7 +1983,6 @@ int window_pane_visible(struct window_pane *);
char *window_pane_search(
struct window_pane *, const char *, u_int *);
char *window_printable_flags(struct session *, struct winlink *);
struct window_pane *window_pane_find_up(struct window_pane *);
struct window_pane *window_pane_find_down(struct window_pane *);
struct window_pane *window_pane_find_left(struct window_pane *);