diff --git a/options-table.c b/options-table.c index c6b2695f..084be7e4 100644 --- a/options-table.c +++ b/options-table.c @@ -971,6 +971,18 @@ const struct options_table_entry options_table[] = { .text = "Style of the marked line in copy mode." }, + { .name = "copy-mode-position-format", + .type = OPTIONS_TABLE_STRING, + .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, + .default_str = "#[align=right]" + "#{t/p:top_line_time}#{?#{e|>:#{top_line_time},0}, ,}" + "[#{scroll_position}/#{history_size}]" + "#{?search_timed_out, (timed out)," + "#{?search_count, (#{search_count}" + "#{?search_count_partial,+,} results),}}", + .text = "Format of the position indicator in copy mode." + }, + { .name = "fill-character", .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_WINDOW, diff --git a/screen-write.c b/screen-write.c index fe58ee48..793ad556 100644 --- a/screen-write.c +++ b/screen-write.c @@ -567,9 +567,11 @@ screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px, u_int py, u_int nx, u_int ny) { struct screen *s = ctx->s; + struct window_pane *wp = ctx->wp; + struct tty_ctx ttyctx; struct grid *gd = src->grid; struct grid_cell gc; - u_int xx, yy, cx, cy; + u_int xx, yy, cx = s->cx, cy = s->cy; if (nx == 0 || ny == 0) return; @@ -578,18 +580,28 @@ screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src, for (yy = py; yy < py + ny; yy++) { if (yy >= gd->hsize + gd->sy) break; - cx = s->cx; + s->cx = cx; + if (wp != NULL) + screen_write_initctx(ctx, &ttyctx, 0); for (xx = px; xx < px + nx; xx++) { if (xx >= grid_get_line(gd, yy)->cellsize) break; grid_get_cell(gd, xx, yy, &gc); if (xx + gc.data.width > px + nx) break; - grid_view_set_cell(ctx->s->grid, cx, cy, &gc); - cx++; + grid_view_set_cell(ctx->s->grid, s->cx, s->cy, &gc); + if (wp != NULL) { + ttyctx.cell = &gc; + tty_write(tty_cmd_cell, &ttyctx); + ttyctx.ocx++; + } + s->cx++; } - cy++; + s->cy++; } + + s->cx = cx; + s->cy = cy; } /* Select character set for drawing border lines. */ diff --git a/tmux.1 b/tmux.1 index 77b9ae05..a964fb04 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4833,6 +4833,8 @@ see the .Sx STYLES section. .Pp +.It Ic copy-mode-position-format Ar format +Format of the position indicator in copy mode. .It Xo Ic mode-keys .Op Ic vi | emacs .Xc