mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 14:16:18 +00:00
Merge branch 'floating_panes' into floating_panes_staging
This commit is contained in:
@@ -616,8 +616,10 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
|
||||
else
|
||||
width = wp->sx + sb_w - 2;
|
||||
max_width = (int)w->sx - (wp->xoff + 2) - sb_w;
|
||||
if (max_width < 0) max_width = 0;
|
||||
if (width > (u_int)max_width) width = (u_int)max_width;
|
||||
if (max_width < 0)
|
||||
max_width = 0;
|
||||
if (width > (u_int)max_width)
|
||||
width = (u_int)max_width;
|
||||
wp->status_size = width;
|
||||
|
||||
memcpy(&old, &wp->status_screen, sizeof old);
|
||||
@@ -866,40 +868,40 @@ screen_redraw_pane(struct client *c, struct window_pane *wp,
|
||||
}
|
||||
|
||||
/* Get border cell style. */
|
||||
static const struct grid_cell *
|
||||
static void
|
||||
screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
|
||||
u_int y, struct window_pane *wp)
|
||||
u_int y, struct window_pane *wp, struct grid_cell *ngc)
|
||||
{
|
||||
struct client *c = ctx->c;
|
||||
struct session *s = c->session;
|
||||
struct window *w = s->curw->window;
|
||||
struct window_pane *active = server_client_get_pane(c);
|
||||
struct options *wo = w->options;
|
||||
const char *border_opt;
|
||||
struct grid_cell *gc;
|
||||
const char *border_option;
|
||||
struct format_tree *ft;
|
||||
int *flag;
|
||||
|
||||
if (wp->border_gc_set)
|
||||
return (&wp->border_gc);
|
||||
wp->border_gc_set = 1;
|
||||
if (screen_redraw_check_is(ctx, x, y, active)) {
|
||||
flag = &wp->active_border_gc_set;
|
||||
gc = &wp->active_border_gc;
|
||||
border_option = "pane-active-border-style";
|
||||
} else {
|
||||
flag = &wp->border_gc_set;
|
||||
gc = &wp->border_gc;
|
||||
border_option = "pane-border-style";
|
||||
}
|
||||
|
||||
ft = format_create_defaults(NULL, c, s, s->curw, wp);
|
||||
if (!*flag) {
|
||||
ft = format_create_defaults(NULL, c, s, s->curw, wp);
|
||||
|
||||
border_opt = screen_redraw_check_is(ctx, x, y, active) ?
|
||||
"pane-active-border-style" : "pane-border-style";
|
||||
style_apply(gc, w->options, border_option, ft);
|
||||
if (options_get_only(wp->options, border_option) != NULL)
|
||||
style_add(gc, wp->options, border_option, ft);
|
||||
|
||||
/* Window-level baseline. */
|
||||
style_apply(&wp->border_gc, wo, border_opt, ft);
|
||||
|
||||
/* Floating pane window default overrides window baseline. */
|
||||
if (wp->flags & PANE_FLOATING)
|
||||
style_add(&wp->border_gc, wo, "floating-pane-border-style", ft);
|
||||
|
||||
/* Per-pane override (set via new-pane -S or set-option -p). */
|
||||
if (options_get_only(wp->options, border_opt) != NULL)
|
||||
style_add(&wp->border_gc, wp->options, border_opt, ft);
|
||||
|
||||
format_free(ft);
|
||||
return (&wp->border_gc);
|
||||
format_free(ft);
|
||||
*flag = 1;
|
||||
}
|
||||
memcpy(ngc, gc, sizeof *ngc);
|
||||
}
|
||||
|
||||
/* Draw arrow indicator if enabled. */
|
||||
@@ -987,7 +989,6 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
||||
struct format_tree *ft;
|
||||
struct window_pane *wp, *active = server_client_get_pane(c);
|
||||
struct grid_cell gc;
|
||||
const struct grid_cell *tmp;
|
||||
u_int cell_type;
|
||||
u_int x = ctx->ox + i, y = ctx->oy + j;
|
||||
int isolates;
|
||||
@@ -1014,11 +1015,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
||||
}
|
||||
memcpy(&gc, &ctx->no_pane_gc, sizeof gc);
|
||||
} else {
|
||||
tmp = screen_redraw_draw_borders_style(ctx, x, y, wp);
|
||||
if (tmp == NULL)
|
||||
return;
|
||||
memcpy(&gc, tmp, sizeof gc);
|
||||
|
||||
screen_redraw_draw_borders_style(ctx, x, y, wp, &gc);
|
||||
if (server_is_marked(s, s->curw, marked_pane.wp) &&
|
||||
screen_redraw_check_is(ctx, x, y, marked_pane.wp))
|
||||
gc.attr ^= GRID_ATTR_REVERSE;
|
||||
@@ -1058,8 +1055,10 @@ screen_redraw_draw_borders(struct screen_redraw_ctx *ctx)
|
||||
|
||||
log_debug("%s: %s @%u", __func__, c->name, w->id);
|
||||
|
||||
TAILQ_FOREACH(wp, &w->panes, entry)
|
||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
wp->border_gc_set = 0;
|
||||
wp->active_border_gc_set = 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < c->tty.sy - ctx->statuslines; j++) {
|
||||
for (i = 0; i < c->tty.sx; i++)
|
||||
@@ -1155,6 +1154,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
|
||||
return (&sr);
|
||||
}
|
||||
|
||||
w = base_wp->window;
|
||||
if (px + width > w->sx)
|
||||
width = w->sx - px;
|
||||
|
||||
if (r == NULL) {
|
||||
/* Start with the entire width of the range. */
|
||||
server_client_ensure_ranges(&base_wp->r, 1);
|
||||
@@ -1164,7 +1167,6 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
|
||||
r->used = 1;
|
||||
}
|
||||
|
||||
w = base_wp->window;
|
||||
sb = options_get_number(w->options, "pane-scrollbars");
|
||||
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
||||
|
||||
@@ -1324,7 +1326,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
||||
if (wp->yoff + (int)j < (int)ctx->oy ||
|
||||
wp->yoff + (int)j >= (int)ctx->oy + (int)ctx->sy)
|
||||
continue;
|
||||
wy = wp->yoff + j; /* y line within window w */
|
||||
wy = wp->yoff + j; /* y line within window w */
|
||||
py = woy + wy - ctx->oy; /* y line within tty */
|
||||
if (py > tty->sy) {
|
||||
/* Continue if this line is off of tty. */
|
||||
@@ -1401,7 +1403,7 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
int sb_w = wp->scrollbar_style.width;
|
||||
int sb_pad = wp->scrollbar_style.pad;
|
||||
int cm_y, cm_size, xoff = wp->xoff;
|
||||
int sb_x, sb_y = (int)(wp->yoff); /* sb top */
|
||||
int sb_x, sb_y = (int)wp->yoff; /* sb top */
|
||||
|
||||
if (window_pane_mode(wp) == WINDOW_PANE_NO_MODE) {
|
||||
if (sb == PANE_SCROLLBARS_MODAL)
|
||||
|
||||
105
screen-write.c
105
screen-write.c
@@ -178,11 +178,10 @@ screen_write_set_client_cb(struct tty_ctx *ttyctx, struct client *c)
|
||||
static int
|
||||
screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
||||
{
|
||||
struct window_pane *wp = ctx->wp;
|
||||
|
||||
if (ctx->wp == NULL)
|
||||
return (0);
|
||||
struct window_pane *wp = ctx->wp;
|
||||
|
||||
if (ctx->wp == NULL)
|
||||
return (0);
|
||||
if (ctx->flags & SCREEN_WRITE_CHECKED_IF_OBSCURED) {
|
||||
if (ctx->flags & SCREEN_WRITE_OBSCURED)
|
||||
return (1);
|
||||
@@ -190,21 +189,29 @@ screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
||||
}
|
||||
ctx->flags |= SCREEN_WRITE_CHECKED_IF_OBSCURED;
|
||||
|
||||
while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) {
|
||||
if ((wp->flags & PANE_FLOATING) &&
|
||||
((wp->yoff >= ctx->wp->yoff &&
|
||||
wp->yoff <= ctx->wp->yoff + (int)ctx->wp->sy) ||
|
||||
(wp->yoff + (int)wp->sy >= ctx->wp->yoff &&
|
||||
wp->yoff + wp->sy <= ctx->wp->yoff + ctx->wp->sy)) &&
|
||||
((wp->xoff >= ctx->wp->xoff &&
|
||||
wp->xoff <= ctx->wp->xoff + (int)ctx->wp->sx) ||
|
||||
(wp->xoff + (int)wp->sx >= ctx->wp->xoff &&
|
||||
wp->xoff + wp->sx <= ctx->wp->xoff + ctx->wp->sx))) {
|
||||
if (ctx->wp->xoff < 0 ||
|
||||
ctx->wp->yoff < 0 ||
|
||||
ctx->wp->xoff + ctx->wp->sx >= ctx->wp->window->sx ||
|
||||
ctx->wp->yoff + ctx->wp->sy >= ctx->wp->window->sy) {
|
||||
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
||||
return (1);
|
||||
}
|
||||
|
||||
while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) {
|
||||
if ((wp->flags & PANE_FLOATING) &&
|
||||
((wp->yoff >= ctx->wp->yoff &&
|
||||
wp->yoff <= ctx->wp->yoff + (int)ctx->wp->sy) ||
|
||||
(wp->yoff + (int)wp->sy >= ctx->wp->yoff &&
|
||||
wp->yoff + wp->sy <= ctx->wp->yoff + ctx->wp->sy)) &&
|
||||
((wp->xoff >= ctx->wp->xoff &&
|
||||
wp->xoff <= ctx->wp->xoff + (int)ctx->wp->sx) ||
|
||||
(wp->xoff + (int)wp->sx >= ctx->wp->xoff &&
|
||||
wp->xoff + wp->sx <= ctx->wp->xoff + ctx->wp->sx))) {
|
||||
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
||||
return (1);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Set up context for TTY command. */
|
||||
@@ -396,9 +403,9 @@ size_t
|
||||
screen_write_strlen(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *msg;
|
||||
char *msg;
|
||||
struct utf8_data ud;
|
||||
u_char *ptr;
|
||||
u_char *ptr;
|
||||
size_t left, size = 0;
|
||||
enum utf8_state more;
|
||||
|
||||
@@ -551,9 +558,9 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen,
|
||||
{
|
||||
struct grid_cell gc;
|
||||
struct utf8_data *ud = &gc.data;
|
||||
char *msg;
|
||||
u_char *ptr;
|
||||
size_t left, size = 0;
|
||||
char *msg;
|
||||
u_char *ptr;
|
||||
size_t left, size = 0;
|
||||
enum utf8_state more;
|
||||
|
||||
memcpy(&gc, gcp, sizeof gc);
|
||||
@@ -612,11 +619,11 @@ screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src,
|
||||
{
|
||||
struct screen *s = ctx->s;
|
||||
struct window_pane *wp = ctx->wp;
|
||||
struct tty_ctx ttyctx;
|
||||
struct tty_ctx ttyctx;
|
||||
struct grid *gd = src->grid;
|
||||
struct grid_line *gl, *sgl;
|
||||
struct grid_cell gc;
|
||||
u_int xx, yy, cx = s->cx, cy = s->cy;
|
||||
u_int xx, yy, cx = s->cx, cy = s->cy;
|
||||
int yoff = 0;
|
||||
struct visible_ranges *r;
|
||||
|
||||
@@ -662,28 +669,28 @@ screen_write_box_border_set(enum box_lines lines, int cell_type,
|
||||
struct grid_cell *gc)
|
||||
{
|
||||
switch (lines) {
|
||||
case BOX_LINES_NONE:
|
||||
case BOX_LINES_NONE:
|
||||
break;
|
||||
case BOX_LINES_DOUBLE:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_copy(&gc->data, tty_acs_double_borders(cell_type));
|
||||
case BOX_LINES_DOUBLE:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_copy(&gc->data, tty_acs_double_borders(cell_type));
|
||||
break;
|
||||
case BOX_LINES_HEAVY:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_copy(&gc->data, tty_acs_heavy_borders(cell_type));
|
||||
case BOX_LINES_HEAVY:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_copy(&gc->data, tty_acs_heavy_borders(cell_type));
|
||||
break;
|
||||
case BOX_LINES_ROUNDED:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_copy(&gc->data, tty_acs_rounded_borders(cell_type));
|
||||
case BOX_LINES_ROUNDED:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_copy(&gc->data, tty_acs_rounded_borders(cell_type));
|
||||
break;
|
||||
case BOX_LINES_SIMPLE:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_set(&gc->data, SIMPLE_BORDERS[cell_type]);
|
||||
break;
|
||||
case BOX_LINES_PADDED:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_set(&gc->data, PADDED_BORDERS[cell_type]);
|
||||
break;
|
||||
case BOX_LINES_SIMPLE:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_set(&gc->data, SIMPLE_BORDERS[cell_type]);
|
||||
break;
|
||||
case BOX_LINES_PADDED:
|
||||
gc->attr &= ~GRID_ATTR_CHARSET;
|
||||
utf8_set(&gc->data, PADDED_BORDERS[cell_type]);
|
||||
break;
|
||||
case BOX_LINES_SINGLE:
|
||||
case BOX_LINES_DEFAULT:
|
||||
gc->attr |= GRID_ATTR_CHARSET;
|
||||
@@ -811,7 +818,7 @@ screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny,
|
||||
enum box_lines lines, const struct grid_cell *gcp, const char *title)
|
||||
{
|
||||
struct screen *s = ctx->s;
|
||||
struct grid_cell gc;
|
||||
struct grid_cell gc;
|
||||
u_int cx, cy, i;
|
||||
|
||||
cx = s->cx;
|
||||
@@ -1117,8 +1124,8 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
||||
{
|
||||
struct window_pane *wp = ctx->wp;
|
||||
struct screen *s = ctx->s;
|
||||
struct grid_cell gc;
|
||||
u_int sx = screen_size_x(s),cx, i, n;
|
||||
struct grid_cell gc;
|
||||
u_int sx = screen_size_x(s), cx, i, n;
|
||||
u_int xoff = wp->xoff, yoff = wp->yoff;
|
||||
struct visible_ranges *r;
|
||||
struct visible_range *ri;
|
||||
@@ -1156,8 +1163,8 @@ void
|
||||
screen_write_alignmenttest(struct screen_write_ctx *ctx)
|
||||
{
|
||||
struct screen *s = ctx->s;
|
||||
struct tty_ctx ttyctx;
|
||||
struct grid_cell gc;
|
||||
struct tty_ctx ttyctx;
|
||||
struct grid_cell gc;
|
||||
u_int xx, yy;
|
||||
|
||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||
@@ -2410,10 +2417,10 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
const struct utf8_data *ud = &gc->data;
|
||||
struct grid_line *gl;
|
||||
struct grid_cell_entry *gce;
|
||||
struct grid_cell tmp_gc, now_gc;
|
||||
struct grid_cell tmp_gc, now_gc;
|
||||
struct tty_ctx ttyctx;
|
||||
u_int sx = screen_size_x(s), sy = screen_size_y(s);
|
||||
u_int width = ud->width, xx, not_wrap, i, n, vis;
|
||||
u_int width = ud->width, xx, not_wrap, i, n, vis;
|
||||
int selected, skip = 1, redraw = 0, yoff = 0;
|
||||
struct visible_ranges *r;
|
||||
struct visible_range *ri;
|
||||
|
||||
10
sort.c
10
sort.c
@@ -425,11 +425,11 @@ sort_get_clients(u_int *n, struct sort_criteria *sort_crit)
|
||||
|
||||
i = 0;
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (c->flags & CLIENT_UNATTACHEDFLAGS)
|
||||
continue;
|
||||
if (~c->flags & CLIENT_ATTACHED)
|
||||
continue;
|
||||
if (lsz <= i) {
|
||||
if (c->flags & CLIENT_UNATTACHEDFLAGS)
|
||||
continue;
|
||||
if (~c->flags & CLIENT_ATTACHED)
|
||||
continue;
|
||||
if (lsz <= i) {
|
||||
lsz += 100;
|
||||
l = xreallocarray(l, lsz, sizeof *l);
|
||||
}
|
||||
|
||||
2
tmux.h
2
tmux.h
@@ -1331,6 +1331,8 @@ struct window_pane {
|
||||
|
||||
int border_gc_set;
|
||||
struct grid_cell border_gc;
|
||||
int active_border_gc_set;
|
||||
struct grid_cell active_border_gc;
|
||||
|
||||
int control_bg;
|
||||
int control_fg;
|
||||
|
||||
Reference in New Issue
Block a user