diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-05-12 14:01:17 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-05-12 14:01:17 +0100 |
commit | 7f813dcb6a71b69c06b51a9f28a5319785504e9a (patch) | |
tree | ed6d26c9c8608180361fb22ec56f7114419675bb | |
parent | 1cdc4568bd1e5feebaa4b3b9c9611ef406b39a21 (diff) | |
parent | 60f7b05c0c9fbee371dac86229d888aed7b0e7f6 (diff) | |
download | rtmux-7f813dcb6a71b69c06b51a9f28a5319785504e9a.tar.gz rtmux-7f813dcb6a71b69c06b51a9f28a5319785504e9a.tar.bz2 rtmux-7f813dcb6a71b69c06b51a9f28a5319785504e9a.zip |
Merge branch 'obsd-master'
-rw-r--r-- | format.c | 4 | ||||
-rw-r--r-- | input.c | 3 | ||||
-rw-r--r-- | screen-write.c | 3 | ||||
-rw-r--r-- | tmux.h | 4 | ||||
-rw-r--r-- | tty.c | 30 | ||||
-rw-r--r-- | window-copy.c | 25 | ||||
-rw-r--r-- | window.c | 1 |
7 files changed, 48 insertions, 22 deletions
@@ -1415,8 +1415,8 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "pane_synchronized", "%d", !!options_get_number(wp->window->options, "synchronize-panes")); - format_add(ft, "pane_search_string", "%s", - window_copy_search_string(wp)); + if (wp->searchstr != NULL) + format_add(ft, "pane_search_string", "%s", wp->searchstr); format_add(ft, "pane_tty", "%s", wp->tty); format_add(ft, "pane_pid", "%ld", (long) wp->pid); @@ -1308,7 +1308,8 @@ input_csi_dispatch(struct input_ctx *ictx) } break; case INPUT_CSI_ECH: - screen_write_clearcharacter(sctx, input_get(ictx, 0, 1, 1)); + screen_write_clearcharacter(sctx, input_get(ictx, 0, 1, 1), + ictx->cell.cell.bg); break; case INPUT_CSI_DCH: screen_write_deletecharacter(sctx, input_get(ictx, 0, 1, 1), diff --git a/screen-write.c b/screen-write.c index 6631ab56..7dace38a 100644 --- a/screen-write.c +++ b/screen-write.c @@ -606,7 +606,7 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg) /* Clear nx characters. */ void -screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx) +screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg) { struct screen *s = ctx->s; struct tty_ctx ttyctx; @@ -623,6 +623,7 @@ screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx) return; screen_write_initctx(ctx, &ttyctx); + ttyctx.bg = bg; grid_view_clear(s->grid, s->cx, s->cy, nx, 1, 8); @@ -796,6 +796,7 @@ struct window_pane { struct event modetimer; time_t modelast; u_int modeprefix; + char *searchstr; TAILQ_ENTRY(window_pane) entry; RB_ENTRY(window_pane) tree_entry; @@ -2000,7 +2001,7 @@ void screen_write_cursorleft(struct screen_write_ctx *, u_int); void screen_write_alignmenttest(struct screen_write_ctx *); void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int); void screen_write_deletecharacter(struct screen_write_ctx *, u_int, u_int); -void screen_write_clearcharacter(struct screen_write_ctx *, u_int); +void screen_write_clearcharacter(struct screen_write_ctx *, u_int, u_int); void screen_write_insertline(struct screen_write_ctx *, u_int, u_int); void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int); void screen_write_clearline(struct screen_write_ctx *, u_int); @@ -2181,7 +2182,6 @@ void window_copy_vadd(struct window_pane *, const char *, va_list); void window_copy_pageup(struct window_pane *, int); void window_copy_start_drag(struct client *, struct mouse_event *); int window_copy_scroll_position(struct window_pane *); -const char *window_copy_search_string(struct window_pane *); /* window-choose.c */ extern const struct window_mode window_choose_mode; @@ -798,6 +798,7 @@ tty_clear_area(struct tty *tty, const struct window_pane *wp, u_int py, u_int ny, u_int px, u_int nx, u_int bg) { u_int yy; + char tmp[64]; log_debug("%s: %u,%u at %u,%u", __func__, nx, ny, px, py); @@ -807,6 +808,7 @@ tty_clear_area(struct tty *tty, const struct window_pane *wp, u_int py, /* If genuine BCE is available, can try escape sequences. */ if (!tty_fake_bce(tty, wp, bg)) { + /* Use ED if clearing off the bottom of the terminal. */ if (px == 0 && px + nx >= tty->sx && py + ny >= tty->sy && @@ -815,6 +817,32 @@ tty_clear_area(struct tty *tty, const struct window_pane *wp, u_int py, tty_putcode(tty, TTYC_ED); return; } + + /* + * On VT420 compatible terminals we can use DECFRA if the + * background colour isn't default (because it doesn't work + * after SGR 0). + */ + if (tty->term_type == TTY_VT420 && bg != 8) { + xsnprintf(tmp, sizeof tmp, "\033[32;%u;%u;%u;%u$x", + py + 1, px + 1, py + ny, px + nx); + tty_puts(tty, tmp); + return; + } + + /* + * If margins are supported, can just scroll the area off to + * clear it. + */ + if (nx > 2 && + ny > 2 && + tty_use_margin(tty) && + tty_term_has(tty->term, TTYC_INDN)) { + tty_region(tty, py, py + ny - 1); + tty_margin(tty, px, px + nx - 1); + tty_putcode1(tty, TTYC_INDN, ny); + return; + } } /* Couldn't use an escape sequence, loop over the lines. */ @@ -1023,7 +1051,7 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) void tty_cmd_clearcharacter(struct tty *tty, const struct tty_ctx *ctx) { - tty_attributes(tty, &grid_default_cell, ctx->wp); + tty_default_attributes(tty, ctx->wp, ctx->bg); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); diff --git a/window-copy.c b/window-copy.c index 8424bfa6..424ca28d 100644 --- a/window-copy.c +++ b/window-copy.c @@ -208,8 +208,13 @@ window_copy_init(struct window_pane *wp) data->rectflag = 0; data->scroll_exit = 0; - data->searchtype = WINDOW_COPY_OFF; - data->searchstr = NULL; + if (wp->searchstr != NULL) { + data->searchtype = WINDOW_COPY_SEARCHUP; + data->searchstr = xstrdup(wp->searchstr); + } else { + data->searchtype = WINDOW_COPY_OFF; + data->searchstr = NULL; + } data->searchmark = NULL; data->searchx = data->searchy = data->searcho = -1; @@ -1134,6 +1139,9 @@ window_copy_search(struct window_pane *wp, int direction, int moveflag) u_int fx, fy, endline; int wrapflag, cis, found; + free(wp->searchstr); + wp->searchstr = xstrdup(data->searchstr); + fx = data->cx; fy = screen_hsize(data->backing) - data->oy + data->cy; @@ -2482,16 +2490,3 @@ window_copy_drag_update(__unused struct client *c, struct mouse_event *m) if (window_copy_update_selection(wp, 1)) window_copy_redraw_selection(wp, old_cy); } - -const char * -window_copy_search_string(struct window_pane *wp) -{ - struct window_copy_mode_data *data; - - if (wp->mode != &window_copy_mode) - return (""); - data = wp->modedata; - if (data->searchtype == WINDOW_COPY_OFF || data->searchstr == NULL) - return (""); - return (data->searchstr); -} @@ -828,6 +828,7 @@ static void window_pane_destroy(struct window_pane *wp) { window_pane_reset_mode(wp); + free(wp->searchstr); if (wp->fd != -1) { #ifdef HAVE_UTEMPTER |