diff --git a/cmd-display-menu.c b/cmd-display-menu.c index d04a17cb..2f77fc7f 100644 --- a/cmd-display-menu.c +++ b/cmd-display-menu.c @@ -38,8 +38,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 ...", @@ -373,7 +373,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) diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 06f6dc27..25556f3d 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -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); diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index c9439441..b2c167f5 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -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); diff --git a/options-table.c b/options-table.c index f030f2db..15018226 100644 --- a/options-table.c +++ b/options-table.c @@ -285,7 +285,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." }, diff --git a/popup.c b/popup.c index 47427339..01b95e27 100644 --- a/popup.c +++ b/popup.c @@ -345,7 +345,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"); diff --git a/resize.c b/resize.c index 457fee0a..dff95712 100644 --- a/resize.c +++ b/resize.c @@ -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); diff --git a/screen-write.c b/screen-write.c index a732f093..731c2cfd 100644 --- a/screen-write.c +++ b/screen-write.c @@ -2148,7 +2148,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 diff --git a/screen.c b/screen.c index 0eaf4698..1bd14159 100644 --- a/screen.c +++ b/screen.c @@ -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 - * is is enabled. + * it is enabled. */ available = gd->hscrolled; if (gd->flags & GRID_HISTORY && available > 0) { diff --git a/server-fn.c b/server-fn.c index 2f649329..00d0e378 100644 --- a/server-fn.c +++ b/server-fn.c @@ -488,6 +488,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); } diff --git a/tmux.1 b/tmux.1 index fdbf2e11..fbb94644 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3747,7 +3747,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 @@ -6118,7 +6117,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 @@ -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 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" @@ -6471,7 +6476,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 diff --git a/tmux.h b/tmux.h index a50adbfa..7671cca0 100644 --- a/tmux.h +++ b/tmux.h @@ -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_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 *); diff --git a/tty-keys.c b/tty-keys.c index ef80abc4..9f8ff67c 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -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; diff --git a/window-buffer.c b/window-buffer.c index 2e0a9e84..e2c36ed4 100644 --- a/window-buffer.c +++ b/window-buffer.c @@ -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}" diff --git a/window-copy.c b/window-copy.c index bc3713b0..2ca5d961 100644 --- a/window-copy.c +++ b/window-copy.c @@ -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); diff --git a/window.c b/window.c index 77ce41d8..69a42ab7 100644 --- a/window.c +++ b/window.c @@ -338,7 +338,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) @@ -673,7 +673,7 @@ window_zoom(struct window_pane *wp) } int -window_unzoom(struct window *w) +window_unzoom(struct window *w, int notify) { struct window_pane *wp; @@ -690,7 +690,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); } @@ -704,7 +706,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