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). --- tmux.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'tmux.h') diff --git a/tmux.h b/tmux.h index f9f60e6a..06142164 100644 --- a/tmux.h +++ b/tmux.h @@ -651,17 +651,18 @@ struct screen { bitstr_t *tabs; - bitstr_t *dirty; - u_int dirtysize; - struct screen_sel sel; }; /* Screen write context. */ +struct screen_write_collect_item; +struct screen_write_collect_line; struct screen_write_ctx { struct window_pane *wp; struct screen *s; - u_int dirty; + + struct screen_write_collect_item *item; + struct screen_write_collect_line *list; u_int cells; u_int written; @@ -1042,7 +1043,7 @@ struct tty { struct grid_cell cell; - int last_wp; + int last_wp; struct grid_cell last_cell; #define TTY_NOCURSOR 0x1 @@ -1643,6 +1644,7 @@ void tty_write(void (*)(struct tty *, const struct tty_ctx *), struct tty_ctx *); void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *); void tty_cmd_cell(struct tty *, const struct tty_ctx *); +void tty_cmd_cells(struct tty *, const struct tty_ctx *); void tty_cmd_clearendofline(struct tty *, const struct tty_ctx *); void tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *); void tty_cmd_clearline(struct tty *, const struct tty_ctx *); @@ -1911,6 +1913,8 @@ void grid_clear_history(struct grid *); const struct grid_line *grid_peek_line(struct grid *, u_int); void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *); void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *); +void grid_set_cells(struct grid *, u_int, u_int, const struct grid_cell *, + const char *, size_t); void grid_clear(struct grid *, u_int, u_int, u_int, u_int, u_int); void grid_clear_lines(struct grid *, u_int, u_int, u_int); void grid_move_lines(struct grid *, u_int, u_int, u_int, u_int); @@ -1925,6 +1929,8 @@ u_int grid_reflow(struct grid *, struct grid *, u_int); void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *); void grid_view_set_cell(struct grid *, u_int, u_int, const struct grid_cell *); +void grid_view_set_cells(struct grid *, u_int, u_int, + const struct grid_cell *, const char *, size_t); void grid_view_clear_history(struct grid *, u_int); void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int); void grid_view_scroll_region_up(struct grid *, u_int, u_int); @@ -1983,6 +1989,9 @@ void screen_write_clearendofscreen(struct screen_write_ctx *, u_int); void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int); void screen_write_clearscreen(struct screen_write_ctx *, u_int); void screen_write_clearhistory(struct screen_write_ctx *); +void screen_write_collect_end(struct screen_write_ctx *); +void screen_write_collect_add(struct screen_write_ctx *, + const struct grid_cell *); void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *); void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int); void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int); -- cgit From e100d465daefd20da0bb5eea87c4b4896badff16 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Feb 2017 17:31:09 +0000 Subject: Add support for scroll up escape sequence (CSI S) and use it when possible instead of sending individual line feeds. --- tmux.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tmux.h') diff --git a/tmux.h b/tmux.h index 06142164..fe5c4ca6 100644 --- a/tmux.h +++ b/tmux.h @@ -241,6 +241,7 @@ enum tty_code_code { TTYC_ICH1, /* insert_character, ic */ TTYC_IL, /* parm_insert_line, IL */ TTYC_IL1, /* insert_line, il */ + TTYC_INDN, /* parm_index, indn */ TTYC_INVIS, /* enter_secure_mode, mk */ TTYC_IS1, /* init_1string, i1 */ TTYC_IS2, /* init_2string, i2 */ @@ -663,6 +664,7 @@ struct screen_write_ctx { struct screen_write_collect_item *item; struct screen_write_collect_line *list; + u_int scrolled; u_int cells; u_int written; @@ -1658,6 +1660,7 @@ void tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *); void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *); void tty_cmd_insertline(struct tty *, const struct tty_ctx *); void tty_cmd_linefeed(struct tty *, const struct tty_ctx *); +void tty_cmd_scrollup(struct tty *, const struct tty_ctx *); void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *); void tty_cmd_setselection(struct tty *, const struct tty_ctx *); void tty_cmd_rawstring(struct tty *, const struct tty_ctx *); @@ -1984,6 +1987,7 @@ void screen_write_cursormove(struct screen_write_ctx *, u_int, u_int); void screen_write_reverseindex(struct screen_write_ctx *); void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int); void screen_write_linefeed(struct screen_write_ctx *, int); +void screen_write_scrollup(struct screen_write_ctx *, u_int); void screen_write_carriagereturn(struct screen_write_ctx *); void screen_write_clearendofscreen(struct screen_write_ctx *, u_int); void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int); -- cgit