sync with OpenBSD -current

This commit is contained in:
purplerain 2024-03-22 03:21:02 +00:00
parent ffd019c293
commit 5c4b291e07
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
28 changed files with 116 additions and 226 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-detach-client.c,v 1.36 2021/08/21 10:22:38 nicm Exp $ */
/* $OpenBSD: cmd-detach-client.c,v 1.38 2024/03/21 11:27:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-display-menu.c,v 1.42 2023/08/15 07:01:47 nicm Exp $ */
/* $OpenBSD: cmd-display-menu.c,v 1.43 2024/03/21 11:51:32 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_menu_entry = {
.name = "display-menu",
.alias = "menu",
.args = { "b:c:C:H:s:S:Ot:T:x:y:", 1, -1, cmd_display_menu_args_parse },
.usage = "[-O] [-b border-lines] [-c target-client] "
.args = { "b:c:C:H:s:S:MOt:T:x:y:", 1, -1, cmd_display_menu_args_parse },
.usage = "[-MO] [-b border-lines] [-c target-client] "
"[-C starting-choice] [-H selected-style] [-s style] "
"[-S border-style] " CMD_TARGET_PANE_USAGE "[-T title] "
"[-x position] [-y position] name key command ...",
@ -374,7 +374,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'O'))
flags |= MENU_STAYOPEN;
if (!event->m.valid)
if (!event->m.valid && !args_has(args, 'M'))
flags |= MENU_NOMOUSE;
if (menu_display(menu, flags, starting_choice, item, px, py, tc, lines,
style, selected_style, border_style, target, NULL, NULL) != 0)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-display-panes.c,v 1.45 2022/06/30 09:55:53 nicm Exp $ */
/* $OpenBSD: cmd-display-panes.c,v 1.46 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -246,7 +246,7 @@ cmd_display_panes_key(struct client *c, void *data, struct key_event *event)
wp = window_pane_at_index(w, index);
if (wp == NULL)
return (1);
window_unzoom(w);
window_unzoom(w, 1);
xasprintf(&expanded, "%%%u", wp->id);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-resize-pane.c,v 1.52 2022/02/03 11:06:11 nicm Exp $ */
/* $OpenBSD: cmd-resize-pane.c,v 1.53 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -87,7 +87,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'Z')) {
if (w->flags & WINDOW_ZOOMED)
window_unzoom(w);
window_unzoom(w, 1);
else
window_zoom(wp);
server_redraw_window(w);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: options-table.c,v 1.169 2024/02/13 08:10:23 nicm Exp $ */
/* $OpenBSD: options-table.c,v 1.170 2024/03/21 11:53:11 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -286,7 +286,7 @@ const struct options_table_entry options_table[] = {
.scope = OPTIONS_TABLE_SERVER,
.minimum = 0,
.maximum = INT_MAX,
.default_num = 500,
.default_num = 10,
.unit = "milliseconds",
.text = "Time to wait before assuming a key is Escape."
},

View file

@ -1,4 +1,4 @@
/* $OpenBSD: popup.c,v 1.52 2023/08/15 07:01:47 nicm Exp $ */
/* $OpenBSD: popup.c,v 1.53 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -346,7 +346,7 @@ popup_make_pane(struct popup_data *pd, enum layout_type type)
u_int hlimit;
const char *shell;
window_unzoom(w);
window_unzoom(w, 1);
lc = layout_split_pane(wp, type, -1, 0);
hlimit = options_get_number(s->options, "history-limit");

View file

@ -1,4 +1,4 @@
/* $OpenBSD: resize.c,v 1.50 2022/02/17 09:58:47 nicm Exp $ */
/* $OpenBSD: resize.c,v 1.51 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -40,7 +40,7 @@ resize_window(struct window *w, u_int sx, u_int sy, int xpixel, int ypixel)
/* If the window is zoomed, unzoom. */
zoomed = w->flags & WINDOW_ZOOMED;
if (zoomed)
window_unzoom(w);
window_unzoom(w, 1);
/* Resize the layout first. */
layout_resize(w, sx, sy);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: screen-write.c,v 1.224 2023/10/30 16:05:30 nicm Exp $ */
/* $OpenBSD: screen-write.c,v 1.225 2024/03/21 12:10:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -2051,7 +2051,7 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Set the new cell. */
grid_view_set_cell(gd, cx - n, cy, &last);
if (force_wide)
grid_view_set_padding(gd, cx, cy);
grid_view_set_padding(gd, cx - 1, cy);
/*
* Redraw the combined cell. If forcing the cell to width 2, reset the

View file

@ -1,4 +1,4 @@
/* $OpenBSD: screen.c,v 1.84 2023/12/27 20:17:13 nicm Exp $ */
/* $OpenBSD: screen.c,v 1.85 2024/03/21 11:26:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -384,7 +384,7 @@ screen_resize_y(struct screen *s, u_int sy, int eat_empty, u_int *cy)
/*
* Try to pull as much as possible out of scrolled history, if
* is is enabled.
* it is enabled.
*/
available = gd->hscrolled;
if (gd->flags & GRID_HISTORY && available > 0) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: server-fn.c,v 1.135 2024/02/13 08:10:23 nicm Exp $ */
/* $OpenBSD: server-fn.c,v 1.136 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -487,6 +487,6 @@ server_check_unattached(void)
void
server_unzoom_window(struct window *w)
{
if (window_unzoom(w) == 0)
if (window_unzoom(w, 1) == 0)
server_redraw_window(w);
}

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.937 2024/03/13 11:25:50 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.940 2024/03/21 11:53:11 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: March 13 2024 $
.Dd $Mdocdate: March 21 2024 $
.Dt TMUX 1
.Os
.Sh NAME
@ -3745,7 +3745,6 @@ Set the time in milliseconds for which
.Nm
waits after an escape is input to determine if it is part of a function or meta
key sequences.
The default is 500 milliseconds.
.It Ic editor Ar shell-command
Set the command used when
.Nm
@ -6116,7 +6115,7 @@ the default is
.Ql y .
.Tg menu
.It Xo Ic display-menu
.Op Fl O
.Op Fl OM
.Op Fl b Ar border-lines
.Op Fl c Ar target-client
.Op Fl C Ar starting-choice
@ -6223,7 +6222,13 @@ changes this behaviour so that the menu does not close when the mouse button is
released without an item selected the menu is not closed and a mouse button
must be clicked to choose an item.
.Pp
The following keys are also available:
.Fl M
tells
.Nm
the menu should handle mouse events; by default only menus opened from mouse
key bindings do so.
.Pp
The following keys are available in menus:
.Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function"
.It Li "Enter" Ta "Choose selected item"
@ -6469,7 +6474,7 @@ is replaced by the buffer name in
and the result executed as a command.
If
.Ar template
is not given, "paste-buffer -b \[aq]%%\[aq]" is used.
is not given, "paste-buffer -p -b \[aq]%%\[aq]" is used.
.Pp
.Fl O
specifies the initial sort field: one of

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1212 2024/02/13 08:03:50 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1213 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -3021,7 +3021,7 @@ struct window_pane *window_add_pane(struct window *, struct window_pane *,
void window_resize(struct window *, u_int, u_int, int, int);
void window_pane_send_resize(struct window_pane *, u_int, u_int);
int window_zoom(struct window_pane *);
int window_unzoom(struct window *);
int window_unzoom(struct window *, int);
int window_push_zoom(struct window *, int, int);
int window_pop_zoom(struct window *);
void window_lost_pane(struct window *, struct window_pane *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tty-keys.c,v 1.172 2023/09/08 07:05:06 nicm Exp $ */
/* $OpenBSD: tty-keys.c,v 1.173 2024/03/21 11:47:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -1314,26 +1314,21 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
break;
}
/*
* Add terminal features. Hardware level 5 does not offer SIXEL but
* some terminal emulators report it anyway and it does not harm
* to check it here.
*
* DECSLRM and DECFRA should be supported by level 5 as well as level
* 4, but VTE has rather ruined it by advertising level 5 despite not
* supporting them.
*/
/* Add terminal features. */
switch (p[0]) {
case 64: /* level 4 */
tty_add_features(features, "margins,rectfill", ",");
/* FALLTHROUGH */
case 61: /* level 1 */
case 62: /* level 2 */
case 63: /* level 3 */
case 64: /* level 4 */
case 65: /* level 5 */
for (i = 1; i < n; i++) {
log_debug("%s: DA feature: %d", c->name, p[i]);
if (p[i] == 4)
tty_add_features(features, "sixel", ",");
if (p[i] == 21)
tty_add_features(features, "margins", ",");
if (p[i] == 28)
tty_add_features(features, "rectfill", ",");
}
break;
}
@ -1405,11 +1400,6 @@ tty_keys_device_attributes2(struct tty *tty, const char *buf, size_t len,
* we can't use level 5 from DA because of VTE.
*/
switch (p[0]) {
case 41: /* VT420 */
case 61: /* VT510 */
case 64: /* VT520 */
tty_add_features(features, "margins,rectfill", ",");
break;
case 'M': /* mintty */
tty_default_features(features, "mintty", 0);
break;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window-buffer.c,v 1.37 2022/11/03 08:41:53 nicm Exp $ */
/* $OpenBSD: window-buffer.c,v 1.38 2024/03/21 11:32:49 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -36,7 +36,7 @@ static void window_buffer_key(struct window_mode_entry *,
struct client *, struct session *,
struct winlink *, key_code, struct mouse_event *);
#define WINDOW_BUFFER_DEFAULT_COMMAND "paste-buffer -b '%%'"
#define WINDOW_BUFFER_DEFAULT_COMMAND "paste-buffer -p -b '%%'"
#define WINDOW_BUFFER_DEFAULT_FORMAT \
"#{t/p:buffer_created}: #{buffer_sample}"

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.345 2023/11/02 10:38:14 nicm Exp $ */
/* $OpenBSD: window-copy.c,v 1.346 2024/03/21 11:26:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -795,16 +795,24 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft)
format_add(ft, "copy_cursor_x", "%d", data->cx);
format_add(ft, "copy_cursor_y", "%d", data->cy);
format_add(ft, "selection_present", "%d", data->screen.sel != NULL);
if (data->screen.sel != NULL) {
format_add(ft, "selection_start_x", "%d", data->selx);
format_add(ft, "selection_start_y", "%d", data->sely);
format_add(ft, "selection_end_x", "%d", data->endselx);
format_add(ft, "selection_end_y", "%d", data->endsely);
format_add(ft, "selection_active", "%d",
data->cursordrag != CURSORDRAG_NONE);
} else
format_add(ft, "selection_active", "%d", 0);
if (data->cursordrag != CURSORDRAG_NONE)
format_add(ft, "selection_active", "1");
else
format_add(ft, "selection_active", "0");
if (data->endselx != data->selx && data->endsely != data->sely)
format_add(ft, "selection_present", "1");
else
format_add(ft, "selection_present", "0");
} else {
format_add(ft, "selection_active", "0");
format_add(ft, "selection_present", "0");
}
format_add(ft, "search_present", "%d", data->searchmark != NULL);
format_add_cb(ft, "search_match", window_copy_search_match_cb);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window.c,v 1.288 2024/02/13 08:03:50 nicm Exp $ */
/* $OpenBSD: window.c,v 1.289 2024/03/21 11:30:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -340,7 +340,7 @@ window_destroy(struct window *w)
{
log_debug("window @%u destroyed (%d references)", w->id, w->references);
window_unzoom(w);
window_unzoom(w, 0);
RB_REMOVE(windows, &windows, w);
if (w->layout_root != NULL)
@ -666,7 +666,7 @@ window_zoom(struct window_pane *wp)
}
int
window_unzoom(struct window *w)
window_unzoom(struct window *w, int notify)
{
struct window_pane *wp;
@ -683,7 +683,9 @@ window_unzoom(struct window *w)
wp->saved_layout_cell = NULL;
}
layout_fix_panes(w, NULL);
notify_window("window-layout-changed", w);
if (notify)
notify_window("window-layout-changed", w);
return (0);
}
@ -697,7 +699,7 @@ window_push_zoom(struct window *w, int always, int flag)
w->flags |= WINDOW_WASZOOMED;
else
w->flags &= ~WINDOW_WASZOOMED;
return (window_unzoom(w) == 0);
return (window_unzoom(w, 1) == 0);
}
int