Merge branch 'obsd-master'

pull/3915/head
Thomas Adam 2024-03-21 14:01:10 +00:00
commit 3c3643f580
15 changed files with 48 additions and 43 deletions

View File

@ -38,8 +38,8 @@ const struct cmd_entry cmd_display_menu_entry = {
.name = "display-menu", .name = "display-menu",
.alias = "menu", .alias = "menu",
.args = { "b:c:C:H:s:S:Ot:T:x:y:", 1, -1, cmd_display_menu_args_parse }, .args = { "b:c:C:H:s:S:MOt:T:x:y:", 1, -1, cmd_display_menu_args_parse },
.usage = "[-O] [-b border-lines] [-c target-client] " .usage = "[-MO] [-b border-lines] [-c target-client] "
"[-C starting-choice] [-H selected-style] [-s style] " "[-C starting-choice] [-H selected-style] [-s style] "
"[-S border-style] " CMD_TARGET_PANE_USAGE "[-T title] " "[-S border-style] " CMD_TARGET_PANE_USAGE "[-T title] "
"[-x position] [-y position] name key command ...", "[-x position] [-y position] name key command ...",
@ -373,7 +373,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'O')) if (args_has(args, 'O'))
flags |= MENU_STAYOPEN; flags |= MENU_STAYOPEN;
if (!event->m.valid) if (!event->m.valid && !args_has(args, 'M'))
flags |= MENU_NOMOUSE; flags |= MENU_NOMOUSE;
if (menu_display(menu, flags, starting_choice, item, px, py, tc, lines, if (menu_display(menu, flags, starting_choice, item, px, py, tc, lines,
style, selected_style, border_style, target, NULL, NULL) != 0) style, selected_style, border_style, target, NULL, NULL) != 0)

View File

@ -246,7 +246,7 @@ cmd_display_panes_key(struct client *c, void *data, struct key_event *event)
wp = window_pane_at_index(w, index); wp = window_pane_at_index(w, index);
if (wp == NULL) if (wp == NULL)
return (1); return (1);
window_unzoom(w); window_unzoom(w, 1);
xasprintf(&expanded, "%%%u", wp->id); xasprintf(&expanded, "%%%u", wp->id);

View File

@ -87,7 +87,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'Z')) { if (args_has(args, 'Z')) {
if (w->flags & WINDOW_ZOOMED) if (w->flags & WINDOW_ZOOMED)
window_unzoom(w); window_unzoom(w, 1);
else else
window_zoom(wp); window_zoom(wp);
server_redraw_window(w); server_redraw_window(w);

View File

@ -285,7 +285,7 @@ const struct options_table_entry options_table[] = {
.scope = OPTIONS_TABLE_SERVER, .scope = OPTIONS_TABLE_SERVER,
.minimum = 0, .minimum = 0,
.maximum = INT_MAX, .maximum = INT_MAX,
.default_num = 500, .default_num = 10,
.unit = "milliseconds", .unit = "milliseconds",
.text = "Time to wait before assuming a key is Escape." .text = "Time to wait before assuming a key is Escape."
}, },

View File

@ -345,7 +345,7 @@ popup_make_pane(struct popup_data *pd, enum layout_type type)
u_int hlimit; u_int hlimit;
const char *shell; const char *shell;
window_unzoom(w); window_unzoom(w, 1);
lc = layout_split_pane(wp, type, -1, 0); lc = layout_split_pane(wp, type, -1, 0);
hlimit = options_get_number(s->options, "history-limit"); hlimit = options_get_number(s->options, "history-limit");

View File

@ -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. */ /* If the window is zoomed, unzoom. */
zoomed = w->flags & WINDOW_ZOOMED; zoomed = w->flags & WINDOW_ZOOMED;
if (zoomed) if (zoomed)
window_unzoom(w); window_unzoom(w, 1);
/* Resize the layout first. */ /* Resize the layout first. */
layout_resize(w, sx, sy); layout_resize(w, sx, sy);

View File

@ -2148,7 +2148,7 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Set the new cell. */ /* Set the new cell. */
grid_view_set_cell(gd, cx - n, cy, &last); grid_view_set_cell(gd, cx - n, cy, &last);
if (force_wide) 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 * Redraw the combined cell. If forcing the cell to width 2, reset the

View File

@ -400,7 +400,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 * Try to pull as much as possible out of scrolled history, if
* is is enabled. * it is enabled.
*/ */
available = gd->hscrolled; available = gd->hscrolled;
if (gd->flags & GRID_HISTORY && available > 0) { if (gd->flags & GRID_HISTORY && available > 0) {

View File

@ -488,6 +488,6 @@ server_check_unattached(void)
void void
server_unzoom_window(struct window *w) server_unzoom_window(struct window *w)
{ {
if (window_unzoom(w) == 0) if (window_unzoom(w, 1) == 0)
server_redraw_window(w); server_redraw_window(w);
} }

13
tmux.1
View File

@ -3747,7 +3747,6 @@ Set the time in milliseconds for which
.Nm .Nm
waits after an escape is input to determine if it is part of a function or meta waits after an escape is input to determine if it is part of a function or meta
key sequences. key sequences.
The default is 500 milliseconds.
.It Ic editor Ar shell-command .It Ic editor Ar shell-command
Set the command used when Set the command used when
.Nm .Nm
@ -6118,7 +6117,7 @@ the default is
.Ql y . .Ql y .
.Tg menu .Tg menu
.It Xo Ic display-menu .It Xo Ic display-menu
.Op Fl O .Op Fl OM
.Op Fl b Ar border-lines .Op Fl b Ar border-lines
.Op Fl c Ar target-client .Op Fl c Ar target-client
.Op Fl C Ar starting-choice .Op Fl C Ar starting-choice
@ -6225,7 +6224,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 released without an item selected the menu is not closed and a mouse button
must be clicked to choose an item. must be clicked to choose an item.
.Pp .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 .Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function" .It Sy "Key" Ta Sy "Function"
.It Li "Enter" Ta "Choose selected item" .It Li "Enter" Ta "Choose selected item"
@ -6471,7 +6476,7 @@ is replaced by the buffer name in
and the result executed as a command. and the result executed as a command.
If If
.Ar template .Ar template
is not given, "paste-buffer -b \[aq]%%\[aq]" is used. is not given, "paste-buffer -p -b \[aq]%%\[aq]" is used.
.Pp .Pp
.Fl O .Fl O
specifies the initial sort field: one of specifies the initial sort field: one of

2
tmux.h
View File

@ -3070,7 +3070,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_resize(struct window *, u_int, u_int, int, int);
void window_pane_send_resize(struct window_pane *, u_int, u_int); void window_pane_send_resize(struct window_pane *, u_int, u_int);
int window_zoom(struct window_pane *); 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_push_zoom(struct window *, int, int);
int window_pop_zoom(struct window *); int window_pop_zoom(struct window *);
void window_lost_pane(struct window *, struct window_pane *); void window_lost_pane(struct window *, struct window_pane *);

View File

@ -1314,26 +1314,21 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
break; break;
} }
/* /* Add terminal features. */
* 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.
*/
switch (p[0]) { switch (p[0]) {
case 64: /* level 4 */ case 61: /* level 1 */
tty_add_features(features, "margins,rectfill", ",");
/* FALLTHROUGH */
case 62: /* level 2 */ case 62: /* level 2 */
case 63: /* level 3 */ case 63: /* level 3 */
case 64: /* level 4 */
case 65: /* level 5 */ case 65: /* level 5 */
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
log_debug("%s: DA feature: %d", c->name, p[i]); log_debug("%s: DA feature: %d", c->name, p[i]);
if (p[i] == 4) if (p[i] == 4)
tty_add_features(features, "sixel", ","); tty_add_features(features, "sixel", ",");
if (p[i] == 21)
tty_add_features(features, "margins", ",");
if (p[i] == 28)
tty_add_features(features, "rectfill", ",");
} }
break; 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. * we can't use level 5 from DA because of VTE.
*/ */
switch (p[0]) { switch (p[0]) {
case 41: /* VT420 */
case 61: /* VT510 */
case 64: /* VT520 */
tty_add_features(features, "margins,rectfill", ",");
break;
case 'M': /* mintty */ case 'M': /* mintty */
tty_default_features(features, "mintty", 0); tty_default_features(features, "mintty", 0);
break; break;

View File

@ -36,7 +36,7 @@ static void window_buffer_key(struct window_mode_entry *,
struct client *, struct session *, struct client *, struct session *,
struct winlink *, key_code, struct mouse_event *); 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 \ #define WINDOW_BUFFER_DEFAULT_FORMAT \
"#{t/p:buffer_created}: #{buffer_sample}" "#{t/p:buffer_created}: #{buffer_sample}"

View File

@ -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_x", "%d", data->cx);
format_add(ft, "copy_cursor_y", "%d", data->cy); format_add(ft, "copy_cursor_y", "%d", data->cy);
format_add(ft, "selection_present", "%d", data->screen.sel != NULL);
if (data->screen.sel != NULL) { if (data->screen.sel != NULL) {
format_add(ft, "selection_start_x", "%d", data->selx); format_add(ft, "selection_start_x", "%d", data->selx);
format_add(ft, "selection_start_y", "%d", data->sely); format_add(ft, "selection_start_y", "%d", data->sely);
format_add(ft, "selection_end_x", "%d", data->endselx); format_add(ft, "selection_end_x", "%d", data->endselx);
format_add(ft, "selection_end_y", "%d", data->endsely); format_add(ft, "selection_end_y", "%d", data->endsely);
format_add(ft, "selection_active", "%d",
data->cursordrag != CURSORDRAG_NONE); if (data->cursordrag != CURSORDRAG_NONE)
} else format_add(ft, "selection_active", "1");
format_add(ft, "selection_active", "%d", 0); 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(ft, "search_present", "%d", data->searchmark != NULL);
format_add_cb(ft, "search_match", window_copy_search_match_cb); format_add_cb(ft, "search_match", window_copy_search_match_cb);

View File

@ -338,7 +338,7 @@ window_destroy(struct window *w)
{ {
log_debug("window @%u destroyed (%d references)", w->id, w->references); log_debug("window @%u destroyed (%d references)", w->id, w->references);
window_unzoom(w); window_unzoom(w, 0);
RB_REMOVE(windows, &windows, w); RB_REMOVE(windows, &windows, w);
if (w->layout_root != NULL) if (w->layout_root != NULL)
@ -673,7 +673,7 @@ window_zoom(struct window_pane *wp)
} }
int int
window_unzoom(struct window *w) window_unzoom(struct window *w, int notify)
{ {
struct window_pane *wp; struct window_pane *wp;
@ -690,7 +690,9 @@ window_unzoom(struct window *w)
wp->saved_layout_cell = NULL; wp->saved_layout_cell = NULL;
} }
layout_fix_panes(w, NULL); layout_fix_panes(w, NULL);
notify_window("window-layout-changed", w);
if (notify)
notify_window("window-layout-changed", w);
return (0); return (0);
} }
@ -704,7 +706,7 @@ window_push_zoom(struct window *w, int always, int flag)
w->flags |= WINDOW_WASZOOMED; w->flags |= WINDOW_WASZOOMED;
else else
w->flags &= ~WINDOW_WASZOOMED; w->flags &= ~WINDOW_WASZOOMED;
return (window_unzoom(w) == 0); return (window_unzoom(w, 1) == 0);
} }
int int