Add a vertical (side) status line, GitHub issue 5468 from John DeWyze.

This commit is contained in:
nicm
2026-10-16 07:59:06 +00:00
committed by Nicholas Marriott
parent 647e15b038
commit a7e8801089
20 changed files with 1258 additions and 264 deletions

42
tty.c
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty.c,v 1.490 2026/10/15 22:29:15 nicm Exp $ */
/* $OpenBSD: tty.c,v 1.491 2026/10/16 07:59:06 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -971,7 +971,11 @@ tty_window_bigger(struct tty *tty)
struct client *c = tty->client;
struct window *w = c->session->curw->window;
return (tty->sx < w->sx || tty->sy - status_line_size(c) < w->sy);
if (tty->sx - status_side_size(c) < w->sx)
return (1);
if (tty->sy - status_line_size(c) < w->sy)
return (1);
return (0);
}
/* What offset should this window be drawn at? */
@@ -993,11 +997,12 @@ tty_window_offset1(struct tty *tty, u_int *ox, u_int *oy, u_int *sx, u_int *sy)
struct client *c = tty->client;
struct window *w = c->session->curw->window;
struct window_pane *wp = w->active;
u_int cx, cy, lines;
u_int cx, cy, lines, side;
lines = status_line_size(c);
side = status_side_size(c);
if (tty->sx >= w->sx && tty->sy - lines >= w->sy) {
if (tty->sx - side >= w->sx && tty->sy - lines >= w->sy) {
*ox = 0;
*oy = 0;
*sx = w->sx;
@@ -1007,7 +1012,7 @@ tty_window_offset1(struct tty *tty, u_int *ox, u_int *oy, u_int *sx, u_int *sy)
return (0);
}
*sx = tty->sx;
*sx = tty->sx - side;
*sy = tty->sy - lines;
if (c->pan_window == w) {
@@ -1190,18 +1195,18 @@ tty_clamp_line(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
} else if (xoff < (int)ctx->wox && xoff + nx > ctx->wox + ctx->wsx) {
/* Both left and right not visible. */
*i = ctx->wox - xoff;
*x = 0;
*x = ctx->xoff - ctx->rxoff;
*rx = ctx->wsx;
} else if (xoff < (int)ctx->wox) {
/* Left not visible. */
*i = ctx->wox - (ctx->xoff + px);
*x = 0;
*i = ctx->wox - xoff;
*x = ctx->xoff - ctx->rxoff;
*rx = nx - *i;
} else {
/* Right not visible. */
*i = 0;
*x = (ctx->xoff + px) - ctx->wox;
*rx = ctx->wsx - *x;
*rx = ctx->wox + ctx->wsx - xoff;
}
if (*rx > nx)
fatalx("%s: x too big, %u > %u", __func__, *rx, nx);
@@ -1284,18 +1289,18 @@ tty_clamp_area(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
} else if (xoff < ctx->wox && xoff + nx > ctx->wox + ctx->wsx) {
/* Both left and right not visible. */
*i = ctx->wox - xoff;
*x = 0;
*x = ctx->xoff - ctx->rxoff;
*rx = ctx->wsx;
} else if (xoff < ctx->wox) {
/* Left not visible. */
*i = ctx->wox - (ctx->xoff + px);
*x = 0;
*i = ctx->wox - xoff;
*x = ctx->xoff - ctx->rxoff;
*rx = nx - *i;
} else {
/* Right not visible. */
*i = 0;
*x = (ctx->xoff + px) - ctx->wox;
*rx = ctx->wsx - *x;
*rx = ctx->wox + ctx->wsx - xoff;
}
if (*rx > nx)
fatalx("%s: x too big, %u > %u", __func__, *rx, nx);
@@ -1936,8 +1941,8 @@ tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
return;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) &&
(ctx->xoff + ctx->ocx < ctx->wox ||
ctx->xoff + ctx->ocx + n > ctx->wox + ctx->wsx)) {
(ctx->rxoff + ctx->ocx < ctx->wox ||
ctx->rxoff + ctx->ocx + n > ctx->wox + ctx->wsx)) {
if ((~ctx->flags & TTY_CTX_WRAPPED) ||
!tty_full_width(tty, ctx) ||
(tty->term->flags & TERM_NOAM) ||
@@ -2129,10 +2134,11 @@ tty_margin_off(struct tty *tty)
static void
tty_margin_pane(struct tty *tty, const struct tty_ctx *ctx)
{
u_int xoff = ctx->xoff - ctx->rxoff;
int l, r;
l = ctx->xoff - ctx->wox;
r = ctx->xoff + ctx->sx - 1 - ctx->wox;
l = ctx->rxoff - ctx->wox;
r = ctx->rxoff + ctx->sx - 1 - ctx->wox;
if (l < 0)
l = 0;
@@ -2143,7 +2149,7 @@ tty_margin_pane(struct tty *tty, const struct tty_ctx *ctx)
if (r > (int)ctx->wsx)
r = ctx->wsx;
tty_margin(tty, l, r);
tty_margin(tty, xoff + l, xoff + r);
}
/* Set margin at absolute position. */