mirror of
https://github.com/tmux/tmux.git
synced 2025-01-26 07:58:55 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
f797ac9ff6
36
layout.c
36
layout.c
@ -232,20 +232,20 @@ layout_fix_offsets(struct layout_cell *lc)
|
|||||||
* case for the most upper panes only.
|
* case for the most upper panes only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
layout_need_status(struct layout_cell *lc, int at_top)
|
layout_need_status(struct layout_cell *lc, int status)
|
||||||
{
|
{
|
||||||
struct layout_cell *first_lc;
|
struct layout_cell *next;
|
||||||
|
|
||||||
if (lc->parent != NULL) {
|
if (lc->parent != NULL) {
|
||||||
if (lc->parent->type == LAYOUT_LEFTRIGHT)
|
if (lc->parent->type == LAYOUT_LEFTRIGHT)
|
||||||
return (layout_need_status(lc->parent, at_top));
|
return (layout_need_status(lc->parent, status));
|
||||||
|
|
||||||
if (at_top)
|
if (status == PANE_STATUS_TOP)
|
||||||
first_lc = TAILQ_FIRST(&lc->parent->cells);
|
next = TAILQ_FIRST(&lc->parent->cells);
|
||||||
else
|
else
|
||||||
first_lc = TAILQ_LAST(&lc->parent->cells,layout_cells);
|
next = TAILQ_LAST(&lc->parent->cells,layout_cells);
|
||||||
if (lc == first_lc)
|
if (lc == next)
|
||||||
return (layout_need_status(lc->parent, at_top));
|
return (layout_need_status(lc->parent, status));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
@ -264,8 +264,8 @@ layout_fix_panes(struct window *w)
|
|||||||
if ((lc = wp->layout_cell) == NULL)
|
if ((lc = wp->layout_cell) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (status != 0)
|
if (status != PANE_STATUS_OFF)
|
||||||
shift = layout_need_status(lc, status == 1);
|
shift = layout_need_status(lc, status);
|
||||||
else
|
else
|
||||||
shift = 0;
|
shift = 0;
|
||||||
|
|
||||||
@ -317,8 +317,8 @@ layout_resize_check(struct window *w, struct layout_cell *lc,
|
|||||||
available = lc->sx;
|
available = lc->sx;
|
||||||
else {
|
else {
|
||||||
available = lc->sy;
|
available = lc->sy;
|
||||||
if (status != 0)
|
if (status != PANE_STATUS_OFF)
|
||||||
minimum += layout_need_status(lc, status == 1);
|
minimum += layout_need_status(lc, status);
|
||||||
}
|
}
|
||||||
if (available > minimum)
|
if (available > minimum)
|
||||||
available -= minimum;
|
available -= minimum;
|
||||||
@ -862,8 +862,8 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
|
|||||||
break;
|
break;
|
||||||
case LAYOUT_TOPBOTTOM:
|
case LAYOUT_TOPBOTTOM:
|
||||||
minimum = PANE_MINIMUM * 2 + 1;
|
minimum = PANE_MINIMUM * 2 + 1;
|
||||||
if (status != 0)
|
if (status != PANE_STATUS_OFF)
|
||||||
minimum += layout_need_status(lc, status == 1);
|
minimum += layout_need_status(lc, status);
|
||||||
if (sy < minimum)
|
if (sy < minimum)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
break;
|
break;
|
||||||
@ -1030,8 +1030,8 @@ layout_spread_cell(struct window *w, struct layout_cell *parent)
|
|||||||
size = parent->sx;
|
size = parent->sx;
|
||||||
else if (parent->type == LAYOUT_TOPBOTTOM) {
|
else if (parent->type == LAYOUT_TOPBOTTOM) {
|
||||||
size = parent->sy;
|
size = parent->sy;
|
||||||
if (status != 0)
|
if (status != PANE_STATUS_OFF)
|
||||||
size -= layout_need_status(parent, status == 1);
|
size -= layout_need_status(parent, status);
|
||||||
} else
|
} else
|
||||||
return (0);
|
return (0);
|
||||||
if (size < number - 1)
|
if (size < number - 1)
|
||||||
@ -1050,8 +1050,8 @@ layout_spread_cell(struct window *w, struct layout_cell *parent)
|
|||||||
layout_resize_adjust(w, lc, LAYOUT_LEFTRIGHT, change);
|
layout_resize_adjust(w, lc, LAYOUT_LEFTRIGHT, change);
|
||||||
} else if (parent->type == LAYOUT_TOPBOTTOM) {
|
} else if (parent->type == LAYOUT_TOPBOTTOM) {
|
||||||
this = each;
|
this = each;
|
||||||
if (status != 0)
|
if (status != PANE_STATUS_OFF)
|
||||||
this += layout_need_status(lc, status == 1);
|
this += layout_need_status(lc, status);
|
||||||
change = this - (int)lc->sy;
|
change = this - (int)lc->sy;
|
||||||
layout_resize_adjust(w, lc, LAYOUT_TOPBOTTOM, change);
|
layout_resize_adjust(w, lc, LAYOUT_TOPBOTTOM, change);
|
||||||
}
|
}
|
||||||
|
@ -688,7 +688,7 @@ const struct options_table_entry options_table[] = {
|
|||||||
.type = OPTIONS_TABLE_CHOICE,
|
.type = OPTIONS_TABLE_CHOICE,
|
||||||
.scope = OPTIONS_TABLE_WINDOW,
|
.scope = OPTIONS_TABLE_WINDOW,
|
||||||
.choices = options_table_pane_status_list,
|
.choices = options_table_pane_status_list,
|
||||||
.default_num = 0
|
.default_num = PANE_STATUS_OFF
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "pane-border-style",
|
{ .name = "pane-border-style",
|
||||||
|
@ -45,10 +45,6 @@ static void screen_redraw_draw_pane(struct screen_redraw_ctx *,
|
|||||||
|
|
||||||
#define CELL_BORDERS " xqlkmjwvtun~"
|
#define CELL_BORDERS " xqlkmjwvtun~"
|
||||||
|
|
||||||
#define CELL_STATUS_OFF 0
|
|
||||||
#define CELL_STATUS_TOP 1
|
|
||||||
#define CELL_STATUS_BOTTOM 2
|
|
||||||
|
|
||||||
/* Check if cell is on the border of a particular pane. */
|
/* Check if cell is on the border of a particular pane. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py)
|
screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py)
|
||||||
@ -112,12 +108,12 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
|
|||||||
if (px > w->sx || py > w->sy)
|
if (px > w->sx || py > w->sy)
|
||||||
return (CELL_OUTSIDE);
|
return (CELL_OUTSIDE);
|
||||||
|
|
||||||
if (pane_status != CELL_STATUS_OFF) {
|
if (pane_status != PANE_STATUS_OFF) {
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
if (!window_pane_visible(wp))
|
if (!window_pane_visible(wp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pane_status == CELL_STATUS_TOP)
|
if (pane_status == PANE_STATUS_TOP)
|
||||||
line = wp->yoff - 1;
|
line = wp->yoff - 1;
|
||||||
else
|
else
|
||||||
line = wp->yoff + wp->sy;
|
line = wp->yoff + wp->sy;
|
||||||
@ -153,7 +149,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
|
|||||||
borders |= 8;
|
borders |= 8;
|
||||||
if (px <= w->sx && screen_redraw_cell_border(c, px + 1, py))
|
if (px <= w->sx && screen_redraw_cell_border(c, px + 1, py))
|
||||||
borders |= 4;
|
borders |= 4;
|
||||||
if (pane_status == CELL_STATUS_TOP) {
|
if (pane_status == PANE_STATUS_TOP) {
|
||||||
if (py != 0 && screen_redraw_cell_border(c, px, py - 1))
|
if (py != 0 && screen_redraw_cell_border(c, px, py - 1))
|
||||||
borders |= 2;
|
borders |= 2;
|
||||||
} else {
|
} else {
|
||||||
@ -208,9 +204,9 @@ screen_redraw_check_is(u_int px, u_int py, int type, int pane_status,
|
|||||||
border = screen_redraw_cell_border1(wantwp, px, py);
|
border = screen_redraw_cell_border1(wantwp, px, py);
|
||||||
if (border == 0 || border == -1)
|
if (border == 0 || border == -1)
|
||||||
return (0);
|
return (0);
|
||||||
if (pane_status == CELL_STATUS_TOP && border == 4)
|
if (pane_status == PANE_STATUS_TOP && border == 4)
|
||||||
return (0);
|
return (0);
|
||||||
if (pane_status == CELL_STATUS_BOTTOM && border == 3)
|
if (pane_status == PANE_STATUS_BOTTOM && border == 3)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/* If there are more than two panes, that's enough. */
|
/* If there are more than two panes, that's enough. */
|
||||||
@ -222,7 +218,7 @@ screen_redraw_check_is(u_int px, u_int py, int type, int pane_status,
|
|||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
/* With status lines mark the entire line. */
|
/* With status lines mark the entire line. */
|
||||||
if (pane_status != CELL_STATUS_OFF)
|
if (pane_status != PANE_STATUS_OFF)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
/* Check if the pane covers the whole width. */
|
/* Check if the pane covers the whole width. */
|
||||||
@ -324,7 +320,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
|
|||||||
s = &wp->status_screen;
|
s = &wp->status_screen;
|
||||||
|
|
||||||
size = wp->status_size;
|
size = wp->status_size;
|
||||||
if (ctx->pane_status == CELL_STATUS_TOP)
|
if (ctx->pane_status == PANE_STATUS_TOP)
|
||||||
yoff = wp->yoff - 1;
|
yoff = wp->yoff - 1;
|
||||||
else
|
else
|
||||||
yoff = wp->yoff + wp->sy;
|
yoff = wp->yoff + wp->sy;
|
||||||
@ -386,7 +382,7 @@ screen_redraw_update(struct client *c, int flags)
|
|||||||
if (c->overlay_draw != NULL)
|
if (c->overlay_draw != NULL)
|
||||||
flags |= CLIENT_REDRAWOVERLAY;
|
flags |= CLIENT_REDRAWOVERLAY;
|
||||||
|
|
||||||
if (options_get_number(wo, "pane-border-status") != CELL_STATUS_OFF) {
|
if (options_get_number(wo, "pane-border-status") != PANE_STATUS_OFF) {
|
||||||
redraw = 0;
|
redraw = 0;
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
if (screen_redraw_make_pane_status(c, w, wp))
|
if (screen_redraw_make_pane_status(c, w, wp))
|
||||||
@ -441,7 +437,7 @@ screen_redraw_screen(struct client *c)
|
|||||||
screen_redraw_set_context(c, &ctx);
|
screen_redraw_set_context(c, &ctx);
|
||||||
|
|
||||||
if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) {
|
if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) {
|
||||||
if (ctx.pane_status != CELL_STATUS_OFF)
|
if (ctx.pane_status != PANE_STATUS_OFF)
|
||||||
screen_redraw_draw_pane_status(&ctx);
|
screen_redraw_draw_pane_status(&ctx);
|
||||||
screen_redraw_draw_borders(&ctx);
|
screen_redraw_draw_borders(&ctx);
|
||||||
}
|
}
|
||||||
|
5
tmux.h
5
tmux.h
@ -957,6 +957,11 @@ TAILQ_HEAD(winlink_stack, winlink);
|
|||||||
#define WINDOW_SIZE_SMALLEST 1
|
#define WINDOW_SIZE_SMALLEST 1
|
||||||
#define WINDOW_SIZE_MANUAL 2
|
#define WINDOW_SIZE_MANUAL 2
|
||||||
|
|
||||||
|
/* Pane border status option. */
|
||||||
|
#define PANE_STATUS_OFF 0
|
||||||
|
#define PANE_STATUS_TOP 1
|
||||||
|
#define PANE_STATUS_BOTTOM 2
|
||||||
|
|
||||||
/* Layout direction. */
|
/* Layout direction. */
|
||||||
enum layout_type {
|
enum layout_type {
|
||||||
LAYOUT_LEFTRIGHT,
|
LAYOUT_LEFTRIGHT,
|
||||||
|
6
tty.c
6
tty.c
@ -1060,17 +1060,17 @@ tty_clamp_area(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
|
|||||||
*y = ctx->yoff + py - ctx->oy;
|
*y = ctx->yoff + py - ctx->oy;
|
||||||
*ry = ny;
|
*ry = ny;
|
||||||
} else if (yoff < ctx->oy && yoff + ny > ctx->oy + ctx->sy) {
|
} else if (yoff < ctx->oy && yoff + ny > ctx->oy + ctx->sy) {
|
||||||
/* Both left and right not visible. */
|
/* Both top and bottom not visible. */
|
||||||
*j = ctx->oy;
|
*j = ctx->oy;
|
||||||
*y = 0;
|
*y = 0;
|
||||||
*ry = ctx->sy;
|
*ry = ctx->sy;
|
||||||
} else if (yoff < ctx->oy) {
|
} else if (yoff < ctx->oy) {
|
||||||
/* Left not visible. */
|
/* Top not visible. */
|
||||||
*j = ctx->oy - (ctx->yoff + py);
|
*j = ctx->oy - (ctx->yoff + py);
|
||||||
*y = 0;
|
*y = 0;
|
||||||
*ry = ny - *j;
|
*ry = ny - *j;
|
||||||
} else {
|
} else {
|
||||||
/* Right not visible. */
|
/* Bottom not visible. */
|
||||||
*j = 0;
|
*j = 0;
|
||||||
*y = (ctx->yoff + py) - ctx->oy;
|
*y = (ctx->yoff + py) - ctx->oy;
|
||||||
*ry = ctx->sy - *y;
|
*ry = ctx->sy - *y;
|
||||||
|
50
window.c
50
window.c
@ -410,6 +410,7 @@ window_set_name(struct window *w, const char *new_name)
|
|||||||
void
|
void
|
||||||
window_resize(struct window *w, u_int sx, u_int sy)
|
window_resize(struct window *w, u_int sx, u_int sy)
|
||||||
{
|
{
|
||||||
|
log_debug("%s: @%u resize %ux%u", __func__, w->id, sx, sy);
|
||||||
w->sx = sx;
|
w->sx = sx;
|
||||||
w->sy = sy;
|
w->sy = sy;
|
||||||
}
|
}
|
||||||
@ -924,6 +925,7 @@ window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
|
|||||||
wp->sx = sx;
|
wp->sx = sx;
|
||||||
wp->sy = sy;
|
wp->sy = sy;
|
||||||
|
|
||||||
|
log_debug("%s: %%%u resize %ux%u", __func__, wp->id, sx, sy);
|
||||||
screen_resize(&wp->base, sx, sy, wp->saved_grid == NULL);
|
screen_resize(&wp->base, sx, sy, wp->saved_grid == NULL);
|
||||||
|
|
||||||
wme = TAILQ_FIRST(&wp->modes);
|
wme = TAILQ_FIRST(&wp->modes);
|
||||||
@ -1289,25 +1291,35 @@ window_pane_choose_best(struct window_pane **list, u_int size)
|
|||||||
struct window_pane *
|
struct window_pane *
|
||||||
window_pane_find_up(struct window_pane *wp)
|
window_pane_find_up(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
struct window *w;
|
||||||
struct window_pane *next, *best, **list;
|
struct window_pane *next, *best, **list;
|
||||||
u_int edge, left, right, end, size;
|
u_int edge, left, right, end, size;
|
||||||
int status, found;
|
int status, found;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
status = options_get_number(wp->window->options, "pane-border-status");
|
w = wp->window;
|
||||||
|
status = options_get_number(w->options, "pane-border-status");
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
edge = wp->yoff;
|
edge = wp->yoff;
|
||||||
if (edge == (status == 1 ? 1 : 0))
|
if (status == PANE_STATUS_TOP) {
|
||||||
edge = wp->window->sy + 1 - (status == 2 ? 1 : 0);
|
if (edge == 1)
|
||||||
|
edge = w->sy + 1;
|
||||||
|
} else if (status == PANE_STATUS_BOTTOM) {
|
||||||
|
if (edge == 0)
|
||||||
|
edge = w->sy;
|
||||||
|
} else {
|
||||||
|
if (edge == 0)
|
||||||
|
edge = w->sy + 1;
|
||||||
|
}
|
||||||
|
|
||||||
left = wp->xoff;
|
left = wp->xoff;
|
||||||
right = wp->xoff + wp->sx;
|
right = wp->xoff + wp->sx;
|
||||||
|
|
||||||
TAILQ_FOREACH(next, &wp->window->panes, entry) {
|
TAILQ_FOREACH(next, &w->panes, entry) {
|
||||||
if (next == wp)
|
if (next == wp)
|
||||||
continue;
|
continue;
|
||||||
if (next->yoff + next->sy + 1 != edge)
|
if (next->yoff + next->sy + 1 != edge)
|
||||||
@ -1336,25 +1348,35 @@ window_pane_find_up(struct window_pane *wp)
|
|||||||
struct window_pane *
|
struct window_pane *
|
||||||
window_pane_find_down(struct window_pane *wp)
|
window_pane_find_down(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
struct window *w;
|
||||||
struct window_pane *next, *best, **list;
|
struct window_pane *next, *best, **list;
|
||||||
u_int edge, left, right, end, size;
|
u_int edge, left, right, end, size;
|
||||||
int status, found;
|
int status, found;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
status = options_get_number(wp->window->options, "pane-border-status");
|
w = wp->window;
|
||||||
|
status = options_get_number(w->options, "pane-border-status");
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
edge = wp->yoff + wp->sy + 1;
|
edge = wp->yoff + wp->sy + 1;
|
||||||
if (edge >= wp->window->sy - (status == 2 ? 1 : 0))
|
if (status == PANE_STATUS_TOP) {
|
||||||
edge = (status == 1 ? 1 : 0);
|
if (edge >= w->sy)
|
||||||
|
edge = 1;
|
||||||
|
} else if (status == PANE_STATUS_BOTTOM) {
|
||||||
|
if (edge >= w->sy - 1)
|
||||||
|
edge = 0;
|
||||||
|
} else {
|
||||||
|
if (edge >= wp->sy)
|
||||||
|
edge = 0;
|
||||||
|
}
|
||||||
|
|
||||||
left = wp->xoff;
|
left = wp->xoff;
|
||||||
right = wp->xoff + wp->sx;
|
right = wp->xoff + wp->sx;
|
||||||
|
|
||||||
TAILQ_FOREACH(next, &wp->window->panes, entry) {
|
TAILQ_FOREACH(next, &w->panes, entry) {
|
||||||
if (next == wp)
|
if (next == wp)
|
||||||
continue;
|
continue;
|
||||||
if (next->yoff != edge)
|
if (next->yoff != edge)
|
||||||
@ -1383,24 +1405,26 @@ window_pane_find_down(struct window_pane *wp)
|
|||||||
struct window_pane *
|
struct window_pane *
|
||||||
window_pane_find_left(struct window_pane *wp)
|
window_pane_find_left(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
struct window *w;
|
||||||
struct window_pane *next, *best, **list;
|
struct window_pane *next, *best, **list;
|
||||||
u_int edge, top, bottom, end, size;
|
u_int edge, top, bottom, end, size;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
w = wp->window;
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
edge = wp->xoff;
|
edge = wp->xoff;
|
||||||
if (edge == 0)
|
if (edge == 0)
|
||||||
edge = wp->window->sx + 1;
|
edge = w->sx + 1;
|
||||||
|
|
||||||
top = wp->yoff;
|
top = wp->yoff;
|
||||||
bottom = wp->yoff + wp->sy;
|
bottom = wp->yoff + wp->sy;
|
||||||
|
|
||||||
TAILQ_FOREACH(next, &wp->window->panes, entry) {
|
TAILQ_FOREACH(next, &w->panes, entry) {
|
||||||
if (next == wp)
|
if (next == wp)
|
||||||
continue;
|
continue;
|
||||||
if (next->xoff + next->sx + 1 != edge)
|
if (next->xoff + next->sx + 1 != edge)
|
||||||
@ -1429,24 +1453,26 @@ window_pane_find_left(struct window_pane *wp)
|
|||||||
struct window_pane *
|
struct window_pane *
|
||||||
window_pane_find_right(struct window_pane *wp)
|
window_pane_find_right(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
struct window *w;
|
||||||
struct window_pane *next, *best, **list;
|
struct window_pane *next, *best, **list;
|
||||||
u_int edge, top, bottom, end, size;
|
u_int edge, top, bottom, end, size;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
w = wp->window;
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
edge = wp->xoff + wp->sx + 1;
|
edge = wp->xoff + wp->sx + 1;
|
||||||
if (edge >= wp->window->sx)
|
if (edge >= w->sx)
|
||||||
edge = 0;
|
edge = 0;
|
||||||
|
|
||||||
top = wp->yoff;
|
top = wp->yoff;
|
||||||
bottom = wp->yoff + wp->sy;
|
bottom = wp->yoff + wp->sy;
|
||||||
|
|
||||||
TAILQ_FOREACH(next, &wp->window->panes, entry) {
|
TAILQ_FOREACH(next, &w->panes, entry) {
|
||||||
if (next == wp)
|
if (next == wp)
|
||||||
continue;
|
continue;
|
||||||
if (next->xoff != edge)
|
if (next->xoff != edge)
|
||||||
|
Loading…
Reference in New Issue
Block a user