From 7475165cd87d443da34da11298e638d3d17f43e9 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Feb 2017 15:49:29 +0000 Subject: Some other tidying bits. --- tty.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 1b1ae480..02143f97 100644 --- a/tty.c +++ b/tty.c @@ -1156,8 +1156,6 @@ tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx) void tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) { - struct window_pane *wp = ctx->wp; - if (ctx->xoff + ctx->ocx > tty->sx - 1 && ctx->ocy == ctx->orlower) { if (tty_pane_full_width(tty, ctx)) tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); @@ -1167,7 +1165,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); - tty_cell(tty, ctx->cell, wp); + tty_cell(tty, ctx->cell, ctx->wp); } void -- cgit From d4b006b9faf001de41560db2e8fb890c654598e2 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Feb 2017 16:18:20 +0000 Subject: Fix clear start of line. --- tty.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 02143f97..1b7fb55f 100644 --- a/tty.c +++ b/tty.c @@ -954,14 +954,15 @@ tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx) tty_default_attributes(tty, wp, ctx->bg); - tty_cursor_pane(tty, ctx, 0, ctx->ocy); - if (ctx->xoff == 0 && tty_term_has(tty->term, TTYC_EL1) && - !tty_fake_bce(tty, ctx->wp, ctx->bg)) + !tty_fake_bce(tty, ctx->wp, ctx->bg)) { + tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_putcode(tty, TTYC_EL1); - else + } else { + tty_cursor_pane(tty, ctx, 0, ctx->ocy); tty_repeat_space(tty, ctx->ocx + 1); + } } void -- cgit 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). --- tty.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 1b7fb55f..508e4bac 100644 --- a/tty.c +++ b/tty.c @@ -1169,6 +1169,15 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) tty_cell(tty, ctx->cell, ctx->wp); } +void +tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx) +{ + tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); + + tty_attributes(tty, ctx->cell, ctx->wp); + tty_putn(tty, ctx->ptr, ctx->num, ctx->num); +} + void tty_cmd_setselection(struct tty *tty, const struct tty_ctx *ctx) { -- 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. --- tty.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 508e4bac..40bd7a40 100644 --- a/tty.c +++ b/tty.c @@ -1021,6 +1021,32 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) tty_putc(tty, '\n'); } +void +tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx) +{ + struct window_pane *wp = ctx->wp; + u_int i; + + if ((!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) || + tty_fake_bce(tty, wp, ctx->bg) || + !tty_term_has(tty->term, TTYC_CSR)) { + tty_redraw_region(tty, ctx); + return; + } + + tty_attributes(tty, &grid_default_cell, wp); + + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + tty_margin_pane(tty, ctx); + + if (ctx->num == 1 || !tty_term_has(tty->term, TTYC_INDN)) { + tty_cursor(tty, tty->rright, ctx->yoff + tty->rlower); + for (i = 0; i < ctx->num; i++) + tty_putc(tty, '\n'); + } else + tty_putcode1(tty, TTYC_INDN, ctx->num); +} + void tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx) { -- cgit