mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
970e8f734c
@ -36,8 +36,8 @@ const struct cmd_entry cmd_display_menu_entry = {
|
||||
.name = "display-menu",
|
||||
.alias = "menu",
|
||||
|
||||
.args = { "c:t:T:x:y:", 1, -1 },
|
||||
.usage = "[-c target-client] " CMD_TARGET_PANE_USAGE " [-T title] "
|
||||
.args = { "c:t:OT:x:y:", 1, -1 },
|
||||
.usage = "[-O] [-c target-client] " CMD_TARGET_PANE_USAGE " [-T title] "
|
||||
"[-x position] [-y position] name key command ...",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
@ -229,6 +229,8 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmd_display_menu_get_position(tc, item, args, &px, &py, menu->width + 4,
|
||||
menu->count + 2);
|
||||
|
||||
if (args_has(args, 'O'))
|
||||
flags |= MENU_STAYOPEN;
|
||||
if (!event->m.valid)
|
||||
flags |= MENU_NOMOUSE;
|
||||
if (menu_display(menu, flags, item, px, py, tc, target, NULL,
|
||||
|
22
menu.c
22
menu.c
@ -203,16 +203,28 @@ menu_key_cb(struct client *c, struct key_event *event)
|
||||
m->x > md->px + 4 + menu->width ||
|
||||
m->y < md->py + 1 ||
|
||||
m->y > md->py + 1 + count - 1) {
|
||||
if (MOUSE_RELEASE(m->b))
|
||||
return (1);
|
||||
if (~md->flags & MENU_STAYOPEN) {
|
||||
if (MOUSE_RELEASE(m->b))
|
||||
return (1);
|
||||
} else {
|
||||
if (!MOUSE_RELEASE(m->b) &&
|
||||
MOUSE_WHEEL(m->b) == 0 &&
|
||||
!MOUSE_DRAG(m->b))
|
||||
return (1);
|
||||
}
|
||||
if (md->choice != -1) {
|
||||
md->choice = -1;
|
||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
if (MOUSE_RELEASE(m->b))
|
||||
goto chosen;
|
||||
if (~md->flags & MENU_STAYOPEN) {
|
||||
if (MOUSE_RELEASE(m->b))
|
||||
goto chosen;
|
||||
} else {
|
||||
if (MOUSE_WHEEL(m->b) == 0 && !MOUSE_DRAG(m->b))
|
||||
goto chosen;
|
||||
}
|
||||
md->choice = m->y - (md->py + 1);
|
||||
if (md->choice != old)
|
||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||
@ -303,6 +315,8 @@ chosen:
|
||||
if (md->choice == -1)
|
||||
return (1);
|
||||
item = &menu->items[md->choice];
|
||||
if ((md->flags & MENU_STAYOPEN) && item->name == NULL)
|
||||
return (0);
|
||||
if (item->name == NULL || *item->name == '-')
|
||||
return (1);
|
||||
if (md->cb != NULL) {
|
||||
|
@ -1588,10 +1588,6 @@ server_client_check_pane_focus(struct window_pane *wp)
|
||||
if (wp->window->active != wp)
|
||||
goto not_focused;
|
||||
|
||||
/* If we're in a mode, we're not focused. */
|
||||
if (wp->screen != &wp->base)
|
||||
goto not_focused;
|
||||
|
||||
/*
|
||||
* If our window is the current window in any focused clients with an
|
||||
* attached session, we're focused.
|
||||
@ -1691,8 +1687,8 @@ server_client_reset_state(struct client *c)
|
||||
* mode.
|
||||
*/
|
||||
if (options_get_number(oo, "mouse")) {
|
||||
mode &= ~ALL_MOUSE_MODES;
|
||||
if (c->overlay_draw == NULL) {
|
||||
mode &= ~ALL_MOUSE_MODES;
|
||||
TAILQ_FOREACH(loop, &w->panes, entry) {
|
||||
if (loop->screen->mode & MODE_MOUSE_ALL)
|
||||
mode |= MODE_MOUSE_ALL;
|
||||
|
11
tmux.1
11
tmux.1
@ -5331,6 +5331,7 @@ option.
|
||||
This command works only from inside
|
||||
.Nm .
|
||||
.It Xo Ic display-menu
|
||||
.Op Fl O
|
||||
.Op Fl c Ar target-client
|
||||
.Op Fl t Ar target-pane
|
||||
.Op Fl T Ar title
|
||||
@ -5382,8 +5383,14 @@ Both may be a row or column number, or one of the following special values:
|
||||
Each menu consists of items followed by a key shortcut shown in brackets.
|
||||
If the menu is too large to fit on the terminal, it is not displayed.
|
||||
Pressing the key shortcut chooses the corresponding item.
|
||||
If the mouse is enabled and the menu is opened from a mouse key binding, releasing
|
||||
the mouse button with an item selected will choose that item.
|
||||
If the mouse is enabled and the menu is opened from a mouse key binding,
|
||||
releasing the mouse button with an item selected chooses that item and
|
||||
releasing the mouse button without an item selected closes the menu.
|
||||
.Fl O
|
||||
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:
|
||||
.Bl -column "Key" "Function" -offset indent
|
||||
.It Sy "Key" Ta Sy "Function"
|
||||
|
1
tmux.h
1
tmux.h
@ -2981,6 +2981,7 @@ __dead void printflike(1, 2) fatalx(const char *, ...);
|
||||
/* menu.c */
|
||||
#define MENU_NOMOUSE 0x1
|
||||
#define MENU_TAB 0x2
|
||||
#define MENU_STAYOPEN 0x4
|
||||
struct menu *menu_create(const char *);
|
||||
void menu_add_items(struct menu *, const struct menu_item *,
|
||||
struct cmdq_item *, struct client *,
|
||||
|
Loading…
Reference in New Issue
Block a user