mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 14:16:18 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@@ -300,6 +300,7 @@ control_reset_offsets(struct client *c)
|
|||||||
struct control_pane *cp, *cp1;
|
struct control_pane *cp, *cp1;
|
||||||
|
|
||||||
RB_FOREACH_SAFE(cp, control_panes, &cs->panes, cp1) {
|
RB_FOREACH_SAFE(cp, control_panes, &cs->panes, cp1) {
|
||||||
|
control_discard_pane(c, cp);
|
||||||
RB_REMOVE(control_panes, &cs->panes, cp);
|
RB_REMOVE(control_panes, &cs->panes, cp);
|
||||||
free(cp);
|
free(cp);
|
||||||
}
|
}
|
||||||
|
|||||||
6
format.c
6
format.c
@@ -5279,8 +5279,12 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
|||||||
else {
|
else {
|
||||||
value = xstrdup("");
|
value = xstrdup("");
|
||||||
for (i = 0; i < nrep; i++) {
|
for (i = 0; i < nrep; i++) {
|
||||||
if (!format_check_time(es))
|
if (!format_check_time(es)) {
|
||||||
|
free(right);
|
||||||
|
free(left);
|
||||||
|
free(value);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
xasprintf(&new, "%s%s", value, left);
|
xasprintf(&new, "%s%s", value, left);
|
||||||
free(value);
|
free(value);
|
||||||
value = new;
|
value = new;
|
||||||
|
|||||||
@@ -1487,6 +1487,28 @@ const struct options_table_entry options_table[] = {
|
|||||||
"A value of 0 means no limit."
|
"A value of 0 means no limit."
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ .name = "tree-mode-preview-format",
|
||||||
|
.type = OPTIONS_TABLE_STRING,
|
||||||
|
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
||||||
|
.default_str = "#{?pane_format,"
|
||||||
|
"#{pane_index}:#{pane_title},"
|
||||||
|
"#{window_index}:#{window_name}}",
|
||||||
|
.text = "Format of the preview indicator in tree mode."
|
||||||
|
},
|
||||||
|
|
||||||
|
{ .name = "tree-mode-preview-style",
|
||||||
|
.type = OPTIONS_TABLE_STRING,
|
||||||
|
.scope = OPTIONS_TABLE_WINDOW,
|
||||||
|
.default_str = "fg=#{?#{||:"
|
||||||
|
"#{&&:#{pane_format},#{pane_active}},"
|
||||||
|
"#{&&:#{window_format},#{window_active}}},"
|
||||||
|
"#{display-panes-active-colour},"
|
||||||
|
"#{display-panes-colour}}",
|
||||||
|
.flags = OPTIONS_TABLE_IS_STYLE,
|
||||||
|
.separator = ",",
|
||||||
|
.text = "Style of preview indicator in tree mode."
|
||||||
|
},
|
||||||
|
|
||||||
{ .name = "window-active-style",
|
{ .name = "window-active-style",
|
||||||
.type = OPTIONS_TABLE_STRING,
|
.type = OPTIONS_TABLE_STRING,
|
||||||
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
||||||
|
|||||||
33
tmux.1
33
tmux.1
@@ -5148,17 +5148,6 @@ section.
|
|||||||
.It Ic copy\-mode\-position\-format Ar format
|
.It Ic copy\-mode\-position\-format Ar format
|
||||||
Format of the position indicator in copy mode.
|
Format of the position indicator in copy mode.
|
||||||
.Pp
|
.Pp
|
||||||
.It Xo Ic mode\-keys
|
|
||||||
.Op Ic vi | emacs
|
|
||||||
.Xc
|
|
||||||
Use vi or emacs-style key bindings in copy mode.
|
|
||||||
The default is emacs, unless
|
|
||||||
.Ev VISUAL
|
|
||||||
or
|
|
||||||
.Ev EDITOR
|
|
||||||
contains
|
|
||||||
.Ql vi .
|
|
||||||
.Pp
|
|
||||||
.It Ic copy\-mode\-position\-style Ar style
|
.It Ic copy\-mode\-position\-style Ar style
|
||||||
Set the style of the position indicator in copy mode.
|
Set the style of the position indicator in copy mode.
|
||||||
For how to specify
|
For how to specify
|
||||||
@@ -5221,6 +5210,17 @@ and
|
|||||||
.Ic hybrid ,
|
.Ic hybrid ,
|
||||||
they use absolute line numbers.
|
they use absolute line numbers.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Xo Ic mode\-keys
|
||||||
|
.Op Ic vi | emacs
|
||||||
|
.Xc
|
||||||
|
Use vi or emacs-style key bindings in copy mode.
|
||||||
|
The default is emacs, unless
|
||||||
|
.Ev VISUAL
|
||||||
|
or
|
||||||
|
.Ev EDITOR
|
||||||
|
contains
|
||||||
|
.Ql vi .
|
||||||
|
.Pp
|
||||||
.It Ic mode\-style Ar style
|
.It Ic mode\-style Ar style
|
||||||
Set window modes style.
|
Set window modes style.
|
||||||
For how to specify
|
For how to specify
|
||||||
@@ -5465,6 +5465,17 @@ A value of 0 (the default) means no limit.
|
|||||||
When a limit is set, panes are arranged to not exceed this number of columns,
|
When a limit is set, panes are arranged to not exceed this number of columns,
|
||||||
with additional panes stacked in extra rows.
|
with additional panes stacked in extra rows.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic tree\-mode\-preview\-format Ar format
|
||||||
|
Format of the preview indicator in tree mode.
|
||||||
|
.Pp
|
||||||
|
.It Ic tree\-mode\-preview\-style Ar style
|
||||||
|
Set the style of the preview indicator in tree mode.
|
||||||
|
For how to specify
|
||||||
|
.Ar style ,
|
||||||
|
see the
|
||||||
|
.Sx STYLES
|
||||||
|
section.
|
||||||
|
.Pp
|
||||||
.It Ic window\-status\-activity\-style Ar style
|
.It Ic window\-status\-activity\-style Ar style
|
||||||
Set status line style for windows with an activity alert.
|
Set status line style for windows with an activity alert.
|
||||||
For how to specify
|
For how to specify
|
||||||
|
|||||||
114
window-tree.c
114
window-tree.c
@@ -399,44 +399,49 @@ static void
|
|||||||
window_tree_draw_label(struct screen_write_ctx *ctx, u_int px, u_int py,
|
window_tree_draw_label(struct screen_write_ctx *ctx, u_int px, u_int py,
|
||||||
u_int sx, u_int sy, const struct grid_cell *gc, const char *label)
|
u_int sx, u_int sy, const struct grid_cell *gc, const char *label)
|
||||||
{
|
{
|
||||||
size_t len;
|
u_int width, ox, oy;
|
||||||
u_int ox, oy;
|
char *new_label = NULL;
|
||||||
|
|
||||||
len = strlen(label);
|
if (sx < 5 || sy < 3)
|
||||||
if (sx == 0 || sy == 1 || len > sx)
|
|
||||||
return;
|
return;
|
||||||
ox = (sx - len + 1) / 2;
|
width = format_width(label);
|
||||||
|
if (width > sx - 4) {
|
||||||
|
label = new_label = format_trim_left(label, sx - 4);
|
||||||
|
width = format_width(new_label);
|
||||||
|
}
|
||||||
|
if (width == 0)
|
||||||
|
return;
|
||||||
|
ox = (sx - width + 1) / 2;
|
||||||
oy = (sy + 1) / 2;
|
oy = (sy + 1) / 2;
|
||||||
|
|
||||||
if (ox > 1 && ox + len < sx - 1 && sy >= 3) {
|
screen_write_cursormove(ctx, px + ox - 2, py + oy - 1, 0);
|
||||||
screen_write_cursormove(ctx, px + ox - 1, py + oy - 1, 0);
|
screen_write_box(ctx, width + 4, 3, BOX_LINES_DEFAULT,
|
||||||
screen_write_box(ctx, len + 2, 3, BOX_LINES_DEFAULT, NULL,
|
NULL, NULL);
|
||||||
NULL);
|
screen_write_cursormove(ctx, px + ox - 1, py + oy, 0);
|
||||||
}
|
screen_write_clearcharacter(ctx, width + 2, 8);
|
||||||
screen_write_cursormove(ctx, px + ox, py + oy, 0);
|
screen_write_cursormove(ctx, px + ox, py + oy, 0);
|
||||||
screen_write_puts(ctx, gc, "%s", label);
|
format_draw(ctx, gc, width, label, NULL, 0);
|
||||||
|
free(new_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_tree_draw_session(struct window_tree_modedata *data, struct session *s,
|
window_tree_draw_session(struct window_tree_modedata *data, struct session *s,
|
||||||
struct screen_write_ctx *ctx, u_int sx, u_int sy)
|
struct screen_write_ctx *ctx, u_int sx, u_int sy)
|
||||||
{
|
{
|
||||||
struct options *oo = s->options;
|
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
u_int cx = ctx->s->cx, cy = ctx->s->cy;
|
u_int cx = ctx->s->cx, cy = ctx->s->cy;
|
||||||
u_int loop, total, visible, each, width, offset;
|
u_int loop, total, visible, each, width, offset;
|
||||||
u_int current, start, end, remaining, i;
|
u_int current, start, end, remaining, i;
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
int colour, active_colour, left, right;
|
int left, right;
|
||||||
char *label;
|
char *label;
|
||||||
|
const char *format;
|
||||||
|
struct format_tree *ft;
|
||||||
|
struct options *oo;
|
||||||
|
|
||||||
total = winlink_count(&s->windows);
|
total = winlink_count(&s->windows);
|
||||||
|
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
|
||||||
colour = options_get_number(oo, "display-panes-colour");
|
|
||||||
active_colour = options_get_number(oo, "display-panes-active-colour");
|
|
||||||
|
|
||||||
if (sx / total < 24) {
|
if (sx / total < 24) {
|
||||||
visible = sx / 24;
|
visible = sx / 24;
|
||||||
if (visible == 0)
|
if (visible == 0)
|
||||||
@@ -516,11 +521,13 @@ window_tree_draw_session(struct window_tree_modedata *data, struct session *s,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
w = wl->window;
|
w = wl->window;
|
||||||
|
oo = w->options;
|
||||||
|
|
||||||
if (wl == s->curw)
|
ft = format_create(NULL, NULL, FORMAT_WINDOW|w->id, 0);
|
||||||
gc.fg = active_colour;
|
format_defaults(ft, NULL, s, wl, NULL);
|
||||||
else
|
|
||||||
gc.fg = colour;
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
|
style_apply(&gc, oo, "tree-mode-preview-style", ft);
|
||||||
|
|
||||||
if (left)
|
if (left)
|
||||||
offset = 3 + (i * each);
|
offset = 3 + (i * each);
|
||||||
@@ -534,17 +541,19 @@ window_tree_draw_session(struct window_tree_modedata *data, struct session *s,
|
|||||||
screen_write_cursormove(ctx, cx + offset, cy, 0);
|
screen_write_cursormove(ctx, cx + offset, cy, 0);
|
||||||
screen_write_preview(ctx, &w->active->base, width, sy);
|
screen_write_preview(ctx, &w->active->base, width, sy);
|
||||||
|
|
||||||
xasprintf(&label, " %u:%s ", wl->idx, w->name);
|
format = options_get_string(oo, "tree-mode-preview-format");
|
||||||
if (strlen(label) > width) {
|
if (*format != '\0') {
|
||||||
|
label = format_expand(ft, format);
|
||||||
|
if (*label != '\0') {
|
||||||
|
window_tree_draw_label(ctx, cx + offset, cy,
|
||||||
|
width, sy, &gc, label);
|
||||||
|
}
|
||||||
free(label);
|
free(label);
|
||||||
xasprintf(&label, " %u ", wl->idx);
|
|
||||||
}
|
}
|
||||||
window_tree_draw_label(ctx, cx + offset, cy, width, sy, &gc,
|
|
||||||
label);
|
|
||||||
free(label);
|
|
||||||
|
|
||||||
if (loop != end - 1) {
|
if (loop != end - 1) {
|
||||||
screen_write_cursormove(ctx, cx + offset + width, cy, 0);
|
screen_write_cursormove(ctx, cx + offset + width, cy,
|
||||||
|
0);
|
||||||
screen_write_vline(ctx, sy, 0, 0);
|
screen_write_vline(ctx, sy, 0, 0);
|
||||||
}
|
}
|
||||||
loop++;
|
loop++;
|
||||||
@@ -555,23 +564,22 @@ window_tree_draw_session(struct window_tree_modedata *data, struct session *s,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
|
window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
|
||||||
struct window *w, struct screen_write_ctx *ctx, u_int sx, u_int sy)
|
struct winlink *wl, struct screen_write_ctx *ctx, u_int sx, u_int sy)
|
||||||
{
|
{
|
||||||
struct options *oo = s->options;
|
struct window *w = wl->window;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
u_int cx = ctx->s->cx, cy = ctx->s->cy;
|
u_int cx = ctx->s->cx, cy = ctx->s->cy;
|
||||||
u_int loop, total, visible, each, width, offset;
|
u_int loop, total, visible, each, width, offset;
|
||||||
u_int current, start, end, remaining, i, pane_idx;
|
u_int current, start, end, remaining, i;
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
int colour, active_colour, left, right;
|
int left, right;
|
||||||
char *label;
|
char *label;
|
||||||
|
const char *format;
|
||||||
|
struct format_tree *ft;
|
||||||
|
struct options *oo;
|
||||||
|
|
||||||
total = window_count_panes(w);
|
total = window_count_panes(w);
|
||||||
|
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
|
||||||
colour = options_get_number(oo, "display-panes-colour");
|
|
||||||
active_colour = options_get_number(oo, "display-panes-active-colour");
|
|
||||||
|
|
||||||
if (sx / total < 24) {
|
if (sx / total < 24) {
|
||||||
visible = sx / 24;
|
visible = sx / 24;
|
||||||
if (visible == 0)
|
if (visible == 0)
|
||||||
@@ -650,11 +658,13 @@ window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
|
|||||||
loop++;
|
loop++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
oo = wp->options;
|
||||||
|
|
||||||
if (wp == w->active)
|
ft = format_create(NULL, NULL, FORMAT_PANE|wp->id, 0);
|
||||||
gc.fg = active_colour;
|
format_defaults(ft, NULL, s, wl, wp);
|
||||||
else
|
|
||||||
gc.fg = colour;
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
|
style_apply(&gc, oo, "tree-mode-preview-style", ft);
|
||||||
|
|
||||||
if (left)
|
if (left)
|
||||||
offset = 3 + (i * each);
|
offset = 3 + (i * each);
|
||||||
@@ -668,15 +678,19 @@ window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
|
|||||||
screen_write_cursormove(ctx, cx + offset, cy, 0);
|
screen_write_cursormove(ctx, cx + offset, cy, 0);
|
||||||
screen_write_preview(ctx, &wp->base, width, sy);
|
screen_write_preview(ctx, &wp->base, width, sy);
|
||||||
|
|
||||||
if (window_pane_index(wp, &pane_idx) != 0)
|
format = options_get_string(oo, "tree-mode-preview-format");
|
||||||
pane_idx = loop;
|
if (*format != '\0') {
|
||||||
xasprintf(&label, " %u ", pane_idx);
|
label = format_expand(ft, format);
|
||||||
window_tree_draw_label(ctx, cx + offset, cy, each, sy, &gc,
|
if (*label != '\0') {
|
||||||
label);
|
window_tree_draw_label(ctx, cx + offset, cy,
|
||||||
free(label);
|
width, sy, &gc, label);
|
||||||
|
}
|
||||||
|
free(label);
|
||||||
|
}
|
||||||
|
|
||||||
if (loop != end - 1) {
|
if (loop != end - 1) {
|
||||||
screen_write_cursormove(ctx, cx + offset + width, cy, 0);
|
screen_write_cursormove(ctx, cx + offset + width, cy,
|
||||||
|
0);
|
||||||
screen_write_vline(ctx, sy, 0, 0);
|
screen_write_vline(ctx, sy, 0, 0);
|
||||||
}
|
}
|
||||||
loop++;
|
loop++;
|
||||||
@@ -691,10 +705,10 @@ window_tree_draw(void *modedata, void *itemdata, struct screen_write_ctx *ctx,
|
|||||||
{
|
{
|
||||||
struct window_tree_itemdata *item = itemdata;
|
struct window_tree_itemdata *item = itemdata;
|
||||||
struct session *sp;
|
struct session *sp;
|
||||||
struct winlink *wlp;
|
struct winlink *wl;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
|
|
||||||
window_tree_pull_item(item, &sp, &wlp, &wp);
|
window_tree_pull_item(item, &sp, &wl, &wp);
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -705,7 +719,7 @@ window_tree_draw(void *modedata, void *itemdata, struct screen_write_ctx *ctx,
|
|||||||
window_tree_draw_session(modedata, sp, ctx, sx, sy);
|
window_tree_draw_session(modedata, sp, ctx, sx, sy);
|
||||||
break;
|
break;
|
||||||
case WINDOW_TREE_WINDOW:
|
case WINDOW_TREE_WINDOW:
|
||||||
window_tree_draw_window(modedata, sp, wlp->window, ctx, sx, sy);
|
window_tree_draw_window(modedata, sp, wl, ctx, sx, sy);
|
||||||
break;
|
break;
|
||||||
case WINDOW_TREE_PANE:
|
case WINDOW_TREE_PANE:
|
||||||
screen_write_preview(ctx, &wp->base, sx, sy);
|
screen_write_preview(ctx, &wp->base, sx, sy);
|
||||||
|
|||||||
6
window.c
6
window.c
@@ -2009,13 +2009,15 @@ struct style_range *
|
|||||||
window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
|
window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
|
||||||
{
|
{
|
||||||
struct style_ranges *srs;
|
struct style_ranges *srs;
|
||||||
struct window *w = wp->window;
|
struct window *w;
|
||||||
struct options *wo = w->options;
|
struct options *wo;
|
||||||
u_int line;
|
u_int line;
|
||||||
int pane_status;
|
int pane_status;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
w = wp->window;
|
||||||
|
wo = w->options;
|
||||||
srs = &wp->border_status_line.ranges;
|
srs = &wp->border_status_line.ranges;
|
||||||
|
|
||||||
pane_status = options_get_number(wo, "pane-border-status");
|
pane_status = options_get_number(wo, "pane-border-status");
|
||||||
|
|||||||
Reference in New Issue
Block a user