Merge branch 'master' into floating_panes

This commit is contained in:
Nicholas Marriott
2026-05-24 10:05:56 +01:00
5 changed files with 47 additions and 52 deletions

View File

@@ -289,7 +289,7 @@ layout_parse(struct window *w, const char *layout, char **cause)
if (floating_lc != NULL) if (floating_lc != NULL)
layout_assign(&wp, floating_lc, PANE_FLOATING); layout_assign(&wp, floating_lc, PANE_FLOATING);
/* Fix pane Z indexes. */ /* Fix pane z-indexes. */
while (!TAILQ_EMPTY(&w->z_index)) { while (!TAILQ_EMPTY(&w->z_index)) {
wp = TAILQ_FIRST(&w->z_index); wp = TAILQ_FIRST(&w->z_index);
TAILQ_REMOVE(&w->z_index, wp, zentry); TAILQ_REMOVE(&w->z_index, wp, zentry);
@@ -305,7 +305,6 @@ layout_parse(struct window *w, const char *layout, char **cause)
layout_print_cell(tiled_lc, __func__, 0); layout_print_cell(tiled_lc, __func__, 0);
/* Free the floating layout cell, no longer needed. */ /* Free the floating layout cell, no longer needed. */
if (floating_lc != NULL)
layout_free_cell(floating_lc); layout_free_cell(floating_lc);
notify_window("window-layout-changed", w); notify_window("window-layout-changed", w);

View File

@@ -79,6 +79,9 @@ layout_free_cell(struct layout_cell *lc)
{ {
struct layout_cell *lcchild; struct layout_cell *lcchild;
if (lc == NULL)
return;
switch (lc->type) { switch (lc->type) {
case LAYOUT_LEFTRIGHT: case LAYOUT_LEFTRIGHT:
case LAYOUT_TOPBOTTOM: case LAYOUT_TOPBOTTOM:
@@ -234,7 +237,7 @@ layout_make_node(struct layout_cell *lc, enum layout_type type)
lc->wp = NULL; lc->wp = NULL;
} }
/* Fix Z indexes. */ /* Fix z-indexes. */
void void
layout_fix_zindexes(struct window *w, struct layout_cell *lc) layout_fix_zindexes(struct window *w, struct layout_cell *lc)
{ {

View File

@@ -713,10 +713,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
} }
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, NULL); r = screen_redraw_get_visible_ranges(wp, x, yoff, width, NULL);
if (ctx->statustop) if (ctx->statustop)
yoff += ctx->statuslines; yoff += ctx->statuslines;
for (i = 0; i < r->used; i++) { for (i = 0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) if (ri->nx == 0)
@@ -1267,7 +1265,6 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
return (r); return (r);
} }
/* Draw one pane. */ /* Draw one pane. */
static void static void
screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp) screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
@@ -1278,7 +1275,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
struct screen *s = wp->screen; struct screen *s = wp->screen;
struct colour_palette *palette = &wp->palette; struct colour_palette *palette = &wp->palette;
struct grid_cell defaults; struct grid_cell defaults;
u_int i, j, woy, wx, wy, px, py, width; u_int i, j, woy, wx, wy, py, width;
struct visible_ranges *r; struct visible_ranges *r;
struct visible_range *ri; struct visible_range *ri;
@@ -1291,25 +1288,20 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
wp->xoff >= (int)ctx->ox + (int)ctx->sx) wp->xoff >= (int)ctx->ox + (int)ctx->sx)
return; return;
/* woy is window y offset in tty. */
if (ctx->statustop) if (ctx->statustop)
woy = ctx->statuslines; woy = ctx->statuslines;
else else
woy = 0; woy = 0;
for (j = 0; j < wp->sy; j++) { for (j = 0; j < wp->sy; j++) {
if (wp->yoff + (int)j < (int)ctx->oy || if (wp->yoff + (int)j < (int)ctx->oy ||
wp->yoff + (int)j >= (int)ctx->oy + (int)ctx->sy) wp->yoff + (int)j >= (int)ctx->oy + (int)ctx->sy)
continue; 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. */ py = woy + wy - ctx->oy; /* y line within tty */
if (py > tty->sy) if (py > tty->sy) {
/* Continue if this line is off of tty. */ /* Continue if this line is off of tty. */
continue; continue;
}
/* Note: i is apparenty not used now that the vr array
* returns where in s to read from.
*/
if (wp->xoff >= (int)ctx->ox && if (wp->xoff >= (int)ctx->ox &&
wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) { wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) {
/* All visible. */ /* All visible. */
@@ -1338,16 +1330,13 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
/* Get visible ranges of line before we draw it. */ /* Get visible ranges of line before we draw it. */
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, NULL); r = screen_redraw_get_visible_ranges(wp, wx, wy, width, NULL);
tty_default_colours(&defaults, wp); tty_default_colours(&defaults, wp);
for (i = 0; i < r->used; i++) { for (i = 0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) if (ri->nx == 0)
continue; continue;
px = ri->px; tty_draw_line(tty, s, ri->px - wp->xoff, j, ri->nx,
tty_draw_line(tty, s, ri->px - wp->xoff, j, ri->px, py, &defaults, palette);
ri->nx, px, py, &defaults, palette);
} }
} }
@@ -1442,8 +1431,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
struct visible_ranges *r; struct visible_ranges *r;
/* /*
* Size and offset of window relative to tty. * Size and offset of window relative to tty. Status at top offsets
* Status at top offsets window downward. * window downward.
*/ */
sx = ctx->sx; sx = ctx->sx;
sy = tty->sy - ctx->statuslines; sy = tty->sy - ctx->statuslines;
@@ -1451,8 +1440,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
oy = ctx->oy; oy = ctx->oy;
if (ctx->statustop) { if (ctx->statustop) {
sb_y += ctx->statuslines; sb_y += ctx->statuslines;
sy += ctx->statuslines; /* Height of window in tty. */ sy += ctx->statuslines; /* height of window */
oy += ctx->statuslines; /* Top of window in tty. */ oy += ctx->statuslines; /* top of window */
} }
gc = sb_style->gc; gc = sb_style->gc;
@@ -1460,17 +1449,20 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
slgc.fg = gc.bg; slgc.fg = gc.bg;
slgc.bg = gc.fg; slgc.bg = gc.fg;
if (sb_x + (int)sb_w < 0 || sb_x >= sx || sb_y >= sy) if (sb_x + (int)sb_w < 0 || sb_x >= sx || sb_y >= sy) {
/* Whole sb off screen. */ /* Whole scrollbar is off screen. */
return; return;
if (sb_x < 0) }
/* Part of sb on screen. */ if (sb_x < 0) {
/* Part of scrollbar on screen. */
imin = - sb_x; imin = - sb_x;
}
imax = sb_w + sb_pad; imax = sb_w + sb_pad;
if ((int)imax + sb_x > sx) { if ((int)imax + sb_x > sx) {
if (sb_x > sx) if (sb_x > sx) {
/* Whole sb off screen. */ /* Whole scrollbar off screen. */
return; return;
}
imax = sx - sb_x; imax = sx - sb_x;
} }
jmax = sb_h; jmax = sb_h;
@@ -1485,29 +1477,32 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
* subtracting the pan offset oy. * subtracting the pan offset oy.
*/ */
sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */ sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */
if (sb_tty_y > (int)sy) {
if (sb_tty_y > (int)sy) /* Whole scrollbar is off screen. */
/* Whole sb off screen. */
return; return;
if (sb_tty_y < 0) }
if (sb_tty_y < 0) {
/* Scrollbar starts above visible area; skip those rows. */ /* Scrollbar starts above visible area; skip those rows. */
jmin = -sb_tty_y; jmin = -sb_tty_y;
if (sb_tty_y + (int)sb_h <= 0) }
/* Whole sb above visible area. */ if (sb_tty_y + (int)sb_h <= 0) {
/* Whole scrollbar above visible area. */
return; return;
}
jmax = sb_h; jmax = sb_h;
if (sb_tty_y + (int)jmax > (int)sy) if (sb_tty_y + (int)jmax > (int)sy) {
/* Clip to height of tty. */ /* Clip to height of tty. */
jmax = sy - sb_tty_y; jmax = sy - sb_tty_y;
}
for (j = jmin; j < jmax; j++) { for (j = jmin; j < jmax; j++) {
wy = sb_y + j; /* window y coordinate. */ wy = sb_y + j; /* window y coordinate */
py = sb_tty_y + j; /* tty y coordinate. */ py = sb_tty_y + j;/* tty y coordinate */
r = tty_check_overlay_range(tty, sb_x, wy, imax); r = tty_check_overlay_range(tty, sb_x, wy, imax);
r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r); r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);
for (i = imin; i < imax; i++) { for (i = imin; i < imax; i++) {
px = sb_x + ox + i; /* tty x coordinate. */ px = sb_x + ox + i; /* tty x coordinate */
wx = sb_x + i; /* window x coordinate. */ wx = sb_x + i; /* window x coordinate */
if (wx < xoff - (int)sb_w - (int)sb_pad || if (wx < xoff - (int)sb_w - (int)sb_pad ||
px >= sx || px < 0 || px >= sx || px < 0 ||
wy < yoff - 1 || wy < yoff - 1 ||

2
tmux.1
View File

@@ -8343,7 +8343,7 @@ was created but is not linked to the current session.
The window with ID The window with ID
.Ar window\-id , .Ar window\-id ,
which is not linked to the current session, was closed. which is not linked to the current session, was closed.
.It Ic %unlinked\-window\-renamed Ar window\-id .It Ic %unlinked\-window\-renamed Ar window\-id Ar new\-name
The window with ID The window with ID
.Ar window\-id , .Ar window\-id ,
which is not linked to the current session, was renamed. which is not linked to the current session, was renamed.

View File

@@ -347,9 +347,7 @@ window_destroy(struct window *w)
window_unzoom(w, 0); window_unzoom(w, 0);
RB_REMOVE(windows, &windows, w); RB_REMOVE(windows, &windows, w);
if (w->layout_root != NULL)
layout_free_cell(w->layout_root); layout_free_cell(w->layout_root);
if (w->saved_layout_root != NULL)
layout_free_cell(w->saved_layout_root); layout_free_cell(w->saved_layout_root);
free(w->old_layout); free(w->old_layout);