sync with OpenBSD -current
This commit is contained in:
parent
f6cff6bc9b
commit
84a7643638
38 changed files with 674 additions and 418 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: client.c,v 1.162 2024/05/15 09:59:12 nicm Exp $ */
|
||||
/* $OpenBSD: client.c,v 1.163 2024/08/26 07:30:46 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -445,11 +445,12 @@ client_send_identify(const char *ttynam, const char *termname, char **caps,
|
|||
{
|
||||
char **ss;
|
||||
size_t sslen;
|
||||
int fd, flags = client_flags;
|
||||
int fd;
|
||||
uint64_t flags = client_flags;
|
||||
pid_t pid;
|
||||
u_int i;
|
||||
|
||||
proc_send(client_peer, MSG_IDENTIFY_FLAGS, -1, &flags, sizeof flags);
|
||||
proc_send(client_peer, MSG_IDENTIFY_LONGFLAGS, -1, &flags, sizeof flags);
|
||||
proc_send(client_peer, MSG_IDENTIFY_LONGFLAGS, -1, &client_flags,
|
||||
sizeof client_flags);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: cmd-copy-mode.c,v 1.47 2021/08/21 10:22:38 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-copy-mode.c,v 1.48 2024/08/26 07:09:34 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = {
|
|||
.name = "copy-mode",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "eHMs:t:uq", 0, 0, NULL },
|
||||
.usage = "[-eHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE,
|
||||
.args = { "deHMs:t:uq", 0, 0, NULL },
|
||||
.usage = "[-deHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.source = { 's', CMD_FIND_PANE, 0 },
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
@ -91,6 +91,8 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
|
|||
}
|
||||
if (args_has(args, 'u'))
|
||||
window_copy_pageup(wp, 0);
|
||||
if (args_has(args, 'd'))
|
||||
window_copy_pagedown(wp, 0, args_has(args, 'e'));
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: colour.c,v 1.26 2023/01/03 11:43:24 nicm Exp $ */
|
||||
/* $OpenBSD: colour.c,v 1.27 2024/08/26 13:02:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -942,13 +942,17 @@ colour_byname(const char *name)
|
|||
{ "yellow3", 0xcdcd00 },
|
||||
{ "yellow4", 0x8b8b00 }
|
||||
};
|
||||
u_int i;
|
||||
int c;
|
||||
u_int i;
|
||||
int c;
|
||||
const char *errstr;
|
||||
|
||||
if (strncmp(name, "grey", 4) == 0 || strncmp(name, "gray", 4) == 0) {
|
||||
if (!isdigit((u_char)name[4]))
|
||||
return (0xbebebe|COLOUR_FLAG_RGB);
|
||||
c = round(2.55 * atoi(name + 4));
|
||||
if (name[4] == '\0')
|
||||
return (-1);
|
||||
c = strtonum(name + 4, 0, 100, &errstr);
|
||||
if (errstr != NULL)
|
||||
return (-1);
|
||||
c = round(2.55 * c);
|
||||
if (c < 0 || c > 255)
|
||||
return (-1);
|
||||
return (colour_join_rgb(c, c, c));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: format.c,v 1.319 2024/08/21 04:17:09 nicm Exp $ */
|
||||
/* $OpenBSD: format.c,v 1.320 2024/08/26 07:14:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -1136,8 +1136,7 @@ format_cb_mouse_word(struct format_tree *ft)
|
|||
return (NULL);
|
||||
|
||||
if (!TAILQ_EMPTY(&wp->modes)) {
|
||||
if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode ||
|
||||
TAILQ_FIRST(&wp->modes)->mode == &window_view_mode)
|
||||
if (window_pane_mode(wp) != WINDOW_PANE_NO_MODE)
|
||||
return (window_copy_get_word(wp, x, y));
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -1181,8 +1180,7 @@ format_cb_mouse_line(struct format_tree *ft)
|
|||
return (NULL);
|
||||
|
||||
if (!TAILQ_EMPTY(&wp->modes)) {
|
||||
if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode ||
|
||||
TAILQ_FIRST(&wp->modes)->mode == &window_view_mode)
|
||||
if (window_pane_mode(wp) != WINDOW_PANE_NO_MODE)
|
||||
return (window_copy_get_line(wp, y));
|
||||
return (NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: input-keys.c,v 1.97 2024/08/23 13:25:39 nicm Exp $ */
|
||||
/* $OpenBSD: input-keys.c,v 1.98 2024/08/26 07:45:05 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -608,8 +608,9 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
|
|||
* key and no modifiers.
|
||||
*/
|
||||
if (!(key & ~KEYC_MASK_KEY)) {
|
||||
if (key == C0_BS || key == C0_HT ||
|
||||
key == C0_CR || key == C0_ESC ||
|
||||
if (key == C0_HT ||
|
||||
key == C0_CR ||
|
||||
key == C0_ESC ||
|
||||
(key >= 0x20 && key <= 0x7f)) {
|
||||
ud.data[0] = key;
|
||||
input_key_write(__func__, bev, &ud.data[0], 1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: screen-redraw.c,v 1.96 2022/06/30 09:55:53 nicm Exp $ */
|
||||
/* $OpenBSD: screen-redraw.c,v 1.98 2024/08/26 07:34:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -109,12 +109,13 @@ screen_redraw_two_panes(struct window *w, int direction)
|
|||
|
||||
/* Check if cell is on the border of a pane. */
|
||||
static enum screen_redraw_border_type
|
||||
screen_redraw_pane_border(struct window_pane *wp, u_int px, u_int py,
|
||||
int pane_status)
|
||||
screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
||||
u_int px, u_int py)
|
||||
{
|
||||
struct options *oo = wp->window->options;
|
||||
int split = 0;
|
||||
u_int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy;
|
||||
u_int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy;
|
||||
int pane_status = ctx->pane_status;
|
||||
|
||||
/* Inside pane. */
|
||||
if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey)
|
||||
|
@ -189,8 +190,9 @@ screen_redraw_pane_border(struct window_pane *wp, u_int px, u_int py,
|
|||
|
||||
/* Check if a cell is on a border. */
|
||||
static int
|
||||
screen_redraw_cell_border(struct client *c, u_int px, u_int py, int pane_status)
|
||||
screen_redraw_cell_border(struct screen_redraw_ctx *ctx, u_int px, u_int py)
|
||||
{
|
||||
struct client *c = ctx->c;
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp;
|
||||
|
||||
|
@ -206,7 +208,7 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py, int pane_status)
|
|||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
if (!window_pane_visible(wp))
|
||||
continue;
|
||||
switch (screen_redraw_pane_border(wp, px, py, pane_status)) {
|
||||
switch (screen_redraw_pane_border(ctx, wp, px, py)) {
|
||||
case SCREEN_REDRAW_INSIDE:
|
||||
return (0);
|
||||
case SCREEN_REDRAW_OUTSIDE:
|
||||
|
@ -221,9 +223,10 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py, int pane_status)
|
|||
|
||||
/* Work out type of border cell from surrounding cells. */
|
||||
static int
|
||||
screen_redraw_type_of_cell(struct client *c, u_int px, u_int py,
|
||||
int pane_status)
|
||||
screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py)
|
||||
{
|
||||
struct client *c = ctx->c;
|
||||
int pane_status = ctx->pane_status;
|
||||
struct window *w = c->session->curw->window;
|
||||
u_int sx = w->sx, sy = w->sy;
|
||||
int borders = 0;
|
||||
|
@ -236,28 +239,28 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py,
|
|||
* Construct a bitmask of whether the cells to the left (bit 4), right,
|
||||
* top, and bottom (bit 1) of this cell are borders.
|
||||
*/
|
||||
if (px == 0 || screen_redraw_cell_border(c, px - 1, py, pane_status))
|
||||
if (px == 0 || screen_redraw_cell_border(ctx, px - 1, py))
|
||||
borders |= 8;
|
||||
if (px <= sx && screen_redraw_cell_border(c, px + 1, py, pane_status))
|
||||
if (px <= sx && screen_redraw_cell_border(ctx, px + 1, py))
|
||||
borders |= 4;
|
||||
if (pane_status == PANE_STATUS_TOP) {
|
||||
if (py != 0 &&
|
||||
screen_redraw_cell_border(c, px, py - 1, pane_status))
|
||||
screen_redraw_cell_border(ctx, px, py - 1))
|
||||
borders |= 2;
|
||||
if (screen_redraw_cell_border(c, px, py + 1, pane_status))
|
||||
if (screen_redraw_cell_border(ctx, px, py + 1))
|
||||
borders |= 1;
|
||||
} else if (pane_status == PANE_STATUS_BOTTOM) {
|
||||
if (py == 0 ||
|
||||
screen_redraw_cell_border(c, px, py - 1, pane_status))
|
||||
screen_redraw_cell_border(ctx, px, py - 1))
|
||||
borders |= 2;
|
||||
if (py != sy - 1 &&
|
||||
screen_redraw_cell_border(c, px, py + 1, pane_status))
|
||||
screen_redraw_cell_border(ctx, px, py + 1))
|
||||
borders |= 1;
|
||||
} else {
|
||||
if (py == 0 ||
|
||||
screen_redraw_cell_border(c, px, py - 1, pane_status))
|
||||
screen_redraw_cell_border(ctx, px, py - 1))
|
||||
borders |= 2;
|
||||
if (screen_redraw_cell_border(c, px, py + 1, pane_status))
|
||||
if (screen_redraw_cell_border(ctx, px, py + 1))
|
||||
borders |= 1;
|
||||
}
|
||||
|
||||
|
@ -295,11 +298,13 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py,
|
|||
|
||||
/* Check if cell inside a pane. */
|
||||
static int
|
||||
screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
|
||||
screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
||||
struct window_pane **wpp)
|
||||
{
|
||||
struct client *c = ctx->c;
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp, *active;
|
||||
int pane_status = ctx->pane_status;
|
||||
int border;
|
||||
u_int right, line;
|
||||
|
||||
|
@ -308,7 +313,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
|
|||
if (px > w->sx || py > w->sy)
|
||||
return (CELL_OUTSIDE);
|
||||
if (px == w->sx || py == w->sy) /* window border */
|
||||
return (screen_redraw_type_of_cell(c, px, py, pane_status));
|
||||
return (screen_redraw_type_of_cell(ctx, px, py));
|
||||
|
||||
if (pane_status != PANE_STATUS_OFF) {
|
||||
active = wp = server_client_get_pane(c);
|
||||
|
@ -342,12 +347,12 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
|
|||
* If definitely inside, return. If not on border, skip.
|
||||
* Otherwise work out the cell.
|
||||
*/
|
||||
border = screen_redraw_pane_border(wp, px, py, pane_status);
|
||||
border = screen_redraw_pane_border(ctx, wp, px, py);
|
||||
if (border == SCREEN_REDRAW_INSIDE)
|
||||
return (CELL_INSIDE);
|
||||
if (border == SCREEN_REDRAW_OUTSIDE)
|
||||
goto next2;
|
||||
return (screen_redraw_type_of_cell(c, px, py, pane_status));
|
||||
return (screen_redraw_type_of_cell(ctx, px, py));
|
||||
|
||||
next2:
|
||||
wp = TAILQ_NEXT(wp, entry);
|
||||
|
@ -360,12 +365,12 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
|
|||
|
||||
/* Check if the border of a particular pane. */
|
||||
static int
|
||||
screen_redraw_check_is(u_int px, u_int py, int pane_status,
|
||||
screen_redraw_check_is(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
||||
struct window_pane *wp)
|
||||
{
|
||||
enum screen_redraw_border_type border;
|
||||
|
||||
border = screen_redraw_pane_border(wp, px, py, pane_status);
|
||||
border = screen_redraw_pane_border(ctx, wp, px, py);
|
||||
if (border != SCREEN_REDRAW_INSIDE && border != SCREEN_REDRAW_OUTSIDE)
|
||||
return (1);
|
||||
return (0);
|
||||
|
@ -409,11 +414,11 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
|
|||
|
||||
for (i = 0; i < width; i++) {
|
||||
px = wp->xoff + 2 + i;
|
||||
if (rctx->pane_status == PANE_STATUS_TOP)
|
||||
if (pane_status == PANE_STATUS_TOP)
|
||||
py = wp->yoff - 1;
|
||||
else
|
||||
py = wp->yoff + wp->sy;
|
||||
cell_type = screen_redraw_type_of_cell(c, px, py, pane_status);
|
||||
cell_type = screen_redraw_type_of_cell(rctx, px, py);
|
||||
screen_redraw_border_set(w, wp, pane_lines, cell_type, &gc);
|
||||
screen_write_cell(&ctx, &gc);
|
||||
}
|
||||
|
@ -496,8 +501,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
|
|||
}
|
||||
|
||||
/* Update status line and change flags if unchanged. */
|
||||
static int
|
||||
screen_redraw_update(struct client *c, int flags)
|
||||
static uint64_t
|
||||
screen_redraw_update(struct client *c, uint64_t flags)
|
||||
{
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp;
|
||||
|
@ -567,7 +572,7 @@ void
|
|||
screen_redraw_screen(struct client *c)
|
||||
{
|
||||
struct screen_redraw_ctx ctx;
|
||||
int flags;
|
||||
uint64_t flags;
|
||||
|
||||
if (c->flags & CLIENT_SUSPENDED)
|
||||
return;
|
||||
|
@ -638,7 +643,7 @@ screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
|
|||
wp->border_gc_set = 1;
|
||||
|
||||
ft = format_create_defaults(NULL, c, s, s->curw, wp);
|
||||
if (screen_redraw_check_is(x, y, ctx->pane_status, active))
|
||||
if (screen_redraw_check_is(ctx, x, y, active))
|
||||
style_apply(&wp->border_gc, oo, "pane-active-border-style", ft);
|
||||
else
|
||||
style_apply(&wp->border_gc, oo, "pane-border-style", ft);
|
||||
|
@ -663,7 +668,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||
struct overlay_ranges r;
|
||||
u_int cell_type, x = ctx->ox + i, y = ctx->oy + j;
|
||||
int arrows = 0, border;
|
||||
int pane_status = ctx->pane_status, isolates;
|
||||
int isolates;
|
||||
|
||||
if (c->overlay_check != NULL) {
|
||||
c->overlay_check(c, c->overlay_data, x, y, 1, &r);
|
||||
|
@ -671,7 +676,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||
return;
|
||||
}
|
||||
|
||||
cell_type = screen_redraw_check_cell(c, x, y, pane_status, &wp);
|
||||
cell_type = screen_redraw_check_cell(ctx, x, y, &wp);
|
||||
if (cell_type == CELL_INSIDE)
|
||||
return;
|
||||
|
||||
|
@ -692,7 +697,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||
memcpy(&gc, tmp, sizeof gc);
|
||||
|
||||
if (server_is_marked(s, s->curw, marked_pane.wp) &&
|
||||
screen_redraw_check_is(x, y, pane_status, marked_pane.wp))
|
||||
screen_redraw_check_is(ctx, x, y, marked_pane.wp))
|
||||
gc.attr ^= GRID_ATTR_REVERSE;
|
||||
}
|
||||
screen_redraw_border_set(w, wp, ctx->pane_lines, cell_type, &gc);
|
||||
|
@ -719,7 +724,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||
}
|
||||
|
||||
if (wp != NULL && arrows) {
|
||||
border = screen_redraw_pane_border(active, x, y, pane_status);
|
||||
border = screen_redraw_pane_border(ctx, active, x, y);
|
||||
if (((i == wp->xoff + 1 &&
|
||||
(cell_type == CELL_LEFTRIGHT ||
|
||||
(cell_type == CELL_TOPJOIN &&
|
||||
|
@ -732,7 +737,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||
border == SCREEN_REDRAW_BORDER_RIGHT) ||
|
||||
(cell_type == CELL_RIGHTJOIN &&
|
||||
border == SCREEN_REDRAW_BORDER_LEFT)))) &&
|
||||
screen_redraw_check_is(x, y, pane_status, active)) {
|
||||
screen_redraw_check_is(ctx, x, y, active)) {
|
||||
gc.attr |= GRID_ATTR_CHARSET;
|
||||
utf8_set(&gc.data, BORDER_MARKERS[border]);
|
||||
}
|
||||
|
@ -751,7 +756,7 @@ screen_redraw_draw_borders(struct screen_redraw_ctx *ctx)
|
|||
struct session *s = c->session;
|
||||
struct window *w = s->curw->window;
|
||||
struct window_pane *wp;
|
||||
u_int i, j;
|
||||
u_int i, j;
|
||||
|
||||
log_debug("%s: %s @%u", __func__, c->name, w->id);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: server-client.c,v 1.405 2024/04/10 07:29:15 nicm Exp $ */
|
||||
/* $OpenBSD: server-client.c,v 1.406 2024/08/26 07:30:46 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -1870,7 +1870,8 @@ server_client_key_callback(struct cmdq_item *item, void *data)
|
|||
struct timeval tv;
|
||||
struct key_table *table, *first;
|
||||
struct key_binding *bd;
|
||||
int xtimeout, flags;
|
||||
int xtimeout;
|
||||
uint64_t flags;
|
||||
struct cmd_find_state fs;
|
||||
key_code key0, prefix, prefix2;
|
||||
|
||||
|
@ -2569,7 +2570,8 @@ server_client_check_redraw(struct client *c)
|
|||
struct tty *tty = &c->tty;
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp;
|
||||
int needed, flags, mode = tty->mode, new_flags = 0;
|
||||
int needed, tty_flags, mode = tty->mode;
|
||||
uint64_t client_flags = 0;
|
||||
int redraw;
|
||||
u_int bit = 0;
|
||||
struct timeval tv = { .tv_usec = 1000 };
|
||||
|
@ -2603,7 +2605,7 @@ server_client_check_redraw(struct client *c)
|
|||
}
|
||||
}
|
||||
if (needed)
|
||||
new_flags |= CLIENT_REDRAWPANES;
|
||||
client_flags |= CLIENT_REDRAWPANES;
|
||||
}
|
||||
if (needed && (left = EVBUFFER_LENGTH(tty->out)) != 0) {
|
||||
log_debug("%s: redraw deferred (%zu left)", c->name, left);
|
||||
|
@ -2626,20 +2628,20 @@ server_client_check_redraw(struct client *c)
|
|||
* If more that 64 panes, give up and
|
||||
* just redraw the window.
|
||||
*/
|
||||
new_flags &= CLIENT_REDRAWPANES;
|
||||
new_flags |= CLIENT_REDRAWWINDOW;
|
||||
client_flags &= CLIENT_REDRAWPANES;
|
||||
client_flags |= CLIENT_REDRAWWINDOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (c->redraw_panes != 0)
|
||||
c->flags |= CLIENT_REDRAWPANES;
|
||||
}
|
||||
c->flags |= new_flags;
|
||||
c->flags |= client_flags;
|
||||
return;
|
||||
} else if (needed)
|
||||
log_debug("%s: redraw needed", c->name);
|
||||
|
||||
flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR);
|
||||
tty_flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR);
|
||||
tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE))|TTY_NOCURSOR;
|
||||
|
||||
if (~c->flags & CLIENT_REDRAWWINDOW) {
|
||||
|
@ -2671,9 +2673,10 @@ server_client_check_redraw(struct client *c)
|
|||
screen_redraw_screen(c);
|
||||
}
|
||||
|
||||
tty->flags = (tty->flags & ~TTY_NOCURSOR)|(flags & TTY_NOCURSOR);
|
||||
tty->flags = (tty->flags & ~TTY_NOCURSOR)|(tty_flags & TTY_NOCURSOR);
|
||||
tty_update_mode(tty, mode, NULL);
|
||||
tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR))|flags;
|
||||
tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR))|
|
||||
tty_flags;
|
||||
|
||||
c->flags &= ~(CLIENT_ALLREDRAWFLAGS|CLIENT_STATUSFORCE);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: server.c,v 1.206 2024/05/14 10:11:09 nicm Exp $ */
|
||||
/* $OpenBSD: server.c,v 1.207 2024/08/26 07:30:46 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -104,8 +104,8 @@ server_check_marked(void)
|
|||
}
|
||||
|
||||
/* Create server socket. */
|
||||
static int
|
||||
server_create_socket(int flags, char **cause)
|
||||
int
|
||||
server_create_socket(uint64_t flags, char **cause)
|
||||
{
|
||||
struct sockaddr_un sa;
|
||||
size_t size;
|
||||
|
@ -170,7 +170,7 @@ server_tidy_event(__unused int fd, __unused short events, __unused void *data)
|
|||
|
||||
/* Fork new server. */
|
||||
int
|
||||
server_start(struct tmuxproc *client, int flags, struct event_base *base,
|
||||
server_start(struct tmuxproc *client, uint64_t flags, struct event_base *base,
|
||||
int lockfd, char *lockfile)
|
||||
{
|
||||
int fd;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: style.c,v 1.34 2024/01/22 16:34:46 nicm Exp $ */
|
||||
/* $OpenBSD: style.c,v 1.35 2024/08/26 13:02:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -58,10 +58,11 @@ int
|
|||
style_parse(struct style *sy, const struct grid_cell *base, const char *in)
|
||||
{
|
||||
struct style saved;
|
||||
const char delimiters[] = " ,\n", *cp;
|
||||
const char delimiters[] = " ,\n", *errstr;
|
||||
char tmp[256], *found;
|
||||
int value;
|
||||
size_t end;
|
||||
u_int n;
|
||||
|
||||
if (*in == '\0')
|
||||
return (0);
|
||||
|
@ -137,34 +138,31 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in)
|
|||
goto error;
|
||||
if (*found != '%' || found[1] == '\0')
|
||||
goto error;
|
||||
for (cp = found + 1; *cp != '\0'; cp++) {
|
||||
if (!isdigit((u_char)*cp))
|
||||
goto error;
|
||||
}
|
||||
n = strtonum(found + 1, 0, UINT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
goto error;
|
||||
sy->range_type = STYLE_RANGE_PANE;
|
||||
sy->range_argument = atoi(found + 1);
|
||||
sy->range_argument = n;
|
||||
style_set_range_string(sy, "");
|
||||
} else if (strcasecmp(tmp + 6, "window") == 0) {
|
||||
if (found == NULL)
|
||||
goto error;
|
||||
for (cp = found; *cp != '\0'; cp++) {
|
||||
if (!isdigit((u_char)*cp))
|
||||
goto error;
|
||||
}
|
||||
n = strtonum(found, 0, UINT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
goto error;
|
||||
sy->range_type = STYLE_RANGE_WINDOW;
|
||||
sy->range_argument = atoi(found);
|
||||
sy->range_argument = n;
|
||||
style_set_range_string(sy, "");
|
||||
} else if (strcasecmp(tmp + 6, "session") == 0) {
|
||||
if (found == NULL)
|
||||
goto error;
|
||||
if (*found != '$' || found[1] == '\0')
|
||||
goto error;
|
||||
for (cp = found + 1; *cp != '\0'; cp++) {
|
||||
if (!isdigit((u_char)*cp))
|
||||
goto error;
|
||||
}
|
||||
n = strtonum(found + 1, 0, UINT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
goto error;
|
||||
sy->range_type = STYLE_RANGE_SESSION;
|
||||
sy->range_argument = atoi(found + 1);
|
||||
sy->range_argument = n;
|
||||
style_set_range_string(sy, "");
|
||||
} else if (strcasecmp(tmp + 6, "user") == 0) {
|
||||
if (found == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: tmux.1,v 1.951 2024/08/22 09:05:51 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.952 2024/08/26 07:09:34 nicm Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
.\"
|
||||
|
@ -14,7 +14,7 @@
|
|||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: August 22 2024 $
|
||||
.Dd $Mdocdate: August 26 2024 $
|
||||
.Dt TMUX 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -2108,14 +2108,15 @@ The synopsis for the
|
|||
command is:
|
||||
.Bl -tag -width Ds
|
||||
.It Xo Ic copy-mode
|
||||
.Op Fl eHMqu
|
||||
.Op Fl deHMqu
|
||||
.Op Fl s Ar src-pane
|
||||
.Op Fl t Ar target-pane
|
||||
.Xc
|
||||
Enter copy mode.
|
||||
The
|
||||
.Fl u
|
||||
option scrolls one page up.
|
||||
also scrolls one page up after entering and
|
||||
.Fl d
|
||||
one page down if already in copy mode.
|
||||
.Fl M
|
||||
begins a mouse drag (only valid if bound to a mouse key binding, see
|
||||
.Sx MOUSE SUPPORT ) .
|
||||
|
@ -2138,6 +2139,7 @@ This is intended to allow fast scrolling through a pane's history, for
|
|||
example with:
|
||||
.Bd -literal -offset indent
|
||||
bind PageUp copy-mode -eu
|
||||
bind PageDown copy-mode -ed
|
||||
.Ed
|
||||
.El
|
||||
.Pp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tmux.h,v 1.1222 2024/08/23 13:25:39 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.h,v 1.1225 2024/08/26 07:30:46 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -966,6 +966,11 @@ enum pane_lines {
|
|||
#define PANE_BORDER_ARROWS 2
|
||||
#define PANE_BORDER_BOTH 3
|
||||
|
||||
/* Mode returned by window_pane_mode function. */
|
||||
#define WINDOW_PANE_NO_MODE 0
|
||||
#define WINDOW_PANE_COPY_MODE 1
|
||||
#define WINDOW_PANE_VIEW_MODE 2
|
||||
|
||||
/* Screen redraw context. */
|
||||
struct screen_redraw_ctx {
|
||||
struct client *c;
|
||||
|
@ -2698,10 +2703,12 @@ void server_clear_marked(void);
|
|||
int server_is_marked(struct session *, struct winlink *,
|
||||
struct window_pane *);
|
||||
int server_check_marked(void);
|
||||
int server_start(struct tmuxproc *, int, struct event_base *, int, char *);
|
||||
int server_start(struct tmuxproc *, uint64_t, struct event_base *, int,
|
||||
char *);
|
||||
void server_update_socket(void);
|
||||
void server_add_accept(int);
|
||||
void printflike(1, 2) server_add_message(const char *, ...);
|
||||
int server_create_socket(uint64_t, char **);
|
||||
|
||||
/* server-client.c */
|
||||
RB_PROTOTYPE(client_windows, client_window, entry, server_client_window_cmp);
|
||||
|
@ -3112,6 +3119,7 @@ void window_pane_update_used_data(struct window_pane *,
|
|||
struct window_pane_offset *, size_t);
|
||||
void window_set_fill_character(struct window *);
|
||||
void window_pane_default_cursor(struct window_pane *);
|
||||
int window_pane_mode(struct window_pane *);
|
||||
|
||||
/* layout.c */
|
||||
u_int layout_count_cells(struct layout_cell *);
|
||||
|
@ -3218,6 +3226,7 @@ void printflike(3, 4) window_copy_add(struct window_pane *, int, const char *,
|
|||
void printflike(3, 0) window_copy_vadd(struct window_pane *, int, const char *,
|
||||
va_list);
|
||||
void window_copy_pageup(struct window_pane *, int);
|
||||
void window_copy_pagedown(struct window_pane *, int, int);
|
||||
void window_copy_start_drag(struct client *, struct mouse_event *);
|
||||
char *window_copy_get_word(struct window_pane *, u_int, u_int);
|
||||
char *window_copy_get_line(struct window_pane *, u_int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty-keys.c,v 1.177 2024/08/21 04:17:09 nicm Exp $ */
|
||||
/* $OpenBSD: tty-keys.c,v 1.178 2024/08/26 07:45:05 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -812,8 +812,9 @@ first_key:
|
|||
* lowercase, so ^A becomes a|CTRL.
|
||||
*/
|
||||
onlykey = key & KEYC_MASK_KEY;
|
||||
if (onlykey < 0x20 && onlykey != C0_BS &&
|
||||
onlykey != C0_HT && onlykey != C0_CR &&
|
||||
if (onlykey < 0x20 &&
|
||||
onlykey != C0_HT &&
|
||||
onlykey != C0_CR &&
|
||||
onlykey != C0_ESC) {
|
||||
onlykey |= 0x40;
|
||||
if (onlykey >= 'A' && onlykey <= 'Z')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty-term.c,v 1.101 2023/10/17 09:55:32 nicm Exp $ */
|
||||
/* $OpenBSD: tty-term.c,v 1.102 2024/08/26 13:02:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -528,9 +528,10 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
|
|||
struct options_array_item *a;
|
||||
union options_value *ov;
|
||||
u_int i, j;
|
||||
const char *s, *value;
|
||||
const char *s, *value, *errstr;
|
||||
size_t offset, namelen;
|
||||
char *first;
|
||||
int n;
|
||||
|
||||
log_debug("adding term %s", name);
|
||||
|
||||
|
@ -564,8 +565,13 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
|
|||
code->value.string = tty_term_strip(value);
|
||||
break;
|
||||
case TTYCODE_NUMBER:
|
||||
code->type = TTYCODE_NUMBER;
|
||||
code->value.number = atoi(value);
|
||||
n = strtonum(value, 0, INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
log_debug("%s: %s", ent->name, errstr);
|
||||
else {
|
||||
code->type = TTYCODE_NUMBER;
|
||||
code->value.number = n;
|
||||
}
|
||||
break;
|
||||
case TTYCODE_FLAG:
|
||||
code->type = TTYCODE_FLAG;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: window-copy.c,v 1.350 2024/05/14 09:32:37 nicm Exp $ */
|
||||
/* $OpenBSD: window-copy.c,v 1.351 2024/08/26 07:09:34 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -41,7 +41,7 @@ static void window_copy_resize(struct window_mode_entry *, u_int, u_int);
|
|||
static void window_copy_formats(struct window_mode_entry *,
|
||||
struct format_tree *);
|
||||
static void window_copy_pageup1(struct window_mode_entry *, int);
|
||||
static int window_copy_pagedown(struct window_mode_entry *, int, int);
|
||||
static int window_copy_pagedown1(struct window_mode_entry *, int, int);
|
||||
static void window_copy_next_paragraph(struct window_mode_entry *);
|
||||
static void window_copy_previous_paragraph(struct window_mode_entry *);
|
||||
static void window_copy_redraw_selection(struct window_mode_entry *, u_int);
|
||||
|
@ -646,8 +646,18 @@ window_copy_pageup1(struct window_mode_entry *wme, int half_page)
|
|||
window_copy_redraw_screen(wme);
|
||||
}
|
||||
|
||||
void
|
||||
window_copy_pagedown(struct window_pane *wp, int half_page, int scroll_exit)
|
||||
{
|
||||
if (window_copy_pagedown1(TAILQ_FIRST(&wp->modes), half_page,
|
||||
scroll_exit)) {
|
||||
window_pane_reset_mode(wp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
window_copy_pagedown(struct window_mode_entry *wme, int half_page,
|
||||
window_copy_pagedown1(struct window_mode_entry *wme, int half_page,
|
||||
int scroll_exit)
|
||||
{
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
|
@ -1347,7 +1357,7 @@ window_copy_cmd_halfpage_down(struct window_copy_cmd_state *cs)
|
|||
u_int np = wme->prefix;
|
||||
|
||||
for (; np != 0; np--) {
|
||||
if (window_copy_pagedown(wme, 1, data->scroll_exit))
|
||||
if (window_copy_pagedown1(wme, 1, data->scroll_exit))
|
||||
return (WINDOW_COPY_CMD_CANCEL);
|
||||
}
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
|
@ -1361,7 +1371,7 @@ window_copy_cmd_halfpage_down_and_cancel(struct window_copy_cmd_state *cs)
|
|||
u_int np = wme->prefix;
|
||||
|
||||
for (; np != 0; np--) {
|
||||
if (window_copy_pagedown(wme, 1, 1))
|
||||
if (window_copy_pagedown1(wme, 1, 1))
|
||||
return (WINDOW_COPY_CMD_CANCEL);
|
||||
}
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
|
@ -1789,7 +1799,7 @@ window_copy_cmd_page_down(struct window_copy_cmd_state *cs)
|
|||
u_int np = wme->prefix;
|
||||
|
||||
for (; np != 0; np--) {
|
||||
if (window_copy_pagedown(wme, 0, data->scroll_exit))
|
||||
if (window_copy_pagedown1(wme, 0, data->scroll_exit))
|
||||
return (WINDOW_COPY_CMD_CANCEL);
|
||||
}
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
|
@ -1802,7 +1812,7 @@ window_copy_cmd_page_down_and_cancel(struct window_copy_cmd_state *cs)
|
|||
u_int np = wme->prefix;
|
||||
|
||||
for (; np != 0; np--) {
|
||||
if (window_copy_pagedown(wme, 0, 1))
|
||||
if (window_copy_pagedown1(wme, 0, 1))
|
||||
return (WINDOW_COPY_CMD_CANCEL);
|
||||
}
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: window.c,v 1.291 2024/06/24 08:30:50 nicm Exp $ */
|
||||
/* $OpenBSD: window.c,v 1.292 2024/08/26 07:14:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -1662,3 +1662,15 @@ window_pane_default_cursor(struct window_pane *wp)
|
|||
s->default_mode = 0;
|
||||
screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode);
|
||||
}
|
||||
|
||||
int
|
||||
window_pane_mode(struct window_pane *wp)
|
||||
{
|
||||
if (TAILQ_FIRST(&wp->modes) != NULL) {
|
||||
if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode)
|
||||
return (WINDOW_PANE_COPY_MODE);
|
||||
if (TAILQ_FIRST(&wp->modes)->mode == &window_view_mode)
|
||||
return (WINDOW_PANE_VIEW_MODE);
|
||||
}
|
||||
return (WINDOW_PANE_NO_MODE);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue