mirror of
https://github.com/tmux/tmux.git
synced 2024-11-04 18:08:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
374f5ea60c
@ -73,12 +73,10 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
|
|||||||
u_int ox, oy, sx, sy;
|
u_int ox, oy, sx, sy;
|
||||||
|
|
||||||
xp = args_get(args, 'x');
|
xp = args_get(args, 'x');
|
||||||
if (xp == NULL)
|
if (xp == NULL || strcmp(xp, "C") == 0)
|
||||||
*px = 0;
|
*px = (c->tty.sx - 1) / 2 - w / 2;
|
||||||
else if (strcmp(xp, "R") == 0)
|
else if (strcmp(xp, "R") == 0)
|
||||||
*px = c->tty.sx - 1;
|
*px = c->tty.sx - 1;
|
||||||
else if (strcmp(xp, "C") == 0)
|
|
||||||
*px = (c->tty.sx - 1) / 2 - w / 2;
|
|
||||||
else if (strcmp(xp, "P") == 0) {
|
else if (strcmp(xp, "P") == 0) {
|
||||||
tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
|
tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
|
||||||
if (wp->xoff >= ox)
|
if (wp->xoff >= ox)
|
||||||
@ -111,9 +109,7 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
|
|||||||
*px = c->tty.sx - w;
|
*px = c->tty.sx - w;
|
||||||
|
|
||||||
yp = args_get(args, 'y');
|
yp = args_get(args, 'y');
|
||||||
if (yp == NULL)
|
if (yp == NULL || strcmp(yp, "C") == 0)
|
||||||
*py = 0;
|
|
||||||
else if (strcmp(yp, "C") == 0)
|
|
||||||
*py = (c->tty.sy - 1) / 2 + h / 2;
|
*py = (c->tty.sy - 1) / 2 + h / 2;
|
||||||
else if (strcmp(yp, "P") == 0) {
|
else if (strcmp(yp, "P") == 0) {
|
||||||
tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
|
tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
|
||||||
@ -280,7 +276,9 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
|
|
||||||
if (args_has(args, 'K'))
|
if (args_has(args, 'K'))
|
||||||
flags |= POPUP_WRITEKEYS;
|
flags |= POPUP_WRITEKEYS;
|
||||||
if (args_has(args, 'E'))
|
if (args_has(args, 'E') > 1)
|
||||||
|
flags |= POPUP_CLOSEEXITZERO;
|
||||||
|
else if (args_has(args, 'E'))
|
||||||
flags |= POPUP_CLOSEEXIT;
|
flags |= POPUP_CLOSEEXIT;
|
||||||
if (popup_display(flags, item, px, py, w, h, nlines, lines, shellcmd,
|
if (popup_display(flags, item, px, py, w, h, nlines, lines, shellcmd,
|
||||||
cmd, cwd, c, fs) != 0)
|
cmd, cwd, c, fs) != 0)
|
||||||
|
5
popup.c
5
popup.c
@ -260,7 +260,8 @@ popup_key_cb(struct client *c, struct key_event *event)
|
|||||||
if (pd->ictx != NULL && (pd->flags & POPUP_WRITEKEYS)) {
|
if (pd->ictx != NULL && (pd->flags & POPUP_WRITEKEYS)) {
|
||||||
if (KEYC_IS_MOUSE(event->key))
|
if (KEYC_IS_MOUSE(event->key))
|
||||||
return (0);
|
return (0);
|
||||||
if ((~pd->flags & POPUP_CLOSEEXIT) &&
|
if (((pd->flags & (POPUP_CLOSEEXIT|POPUP_CLOSEEXITZERO)) == 0 ||
|
||||||
|
pd->job == NULL) &&
|
||||||
(event->key == '\033' || event->key == '\003'))
|
(event->key == '\033' || event->key == '\003'))
|
||||||
return (1);
|
return (1);
|
||||||
if (pd->job == NULL)
|
if (pd->job == NULL)
|
||||||
@ -347,6 +348,8 @@ popup_job_complete_cb(struct job *job)
|
|||||||
|
|
||||||
if (pd->flags & POPUP_CLOSEEXIT)
|
if (pd->flags & POPUP_CLOSEEXIT)
|
||||||
server_client_clear_overlay(pd->c);
|
server_client_clear_overlay(pd->c);
|
||||||
|
if ((pd->flags & POPUP_CLOSEEXITZERO) && pd->status == 0)
|
||||||
|
server_client_clear_overlay(pd->c);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int
|
u_int
|
||||||
|
5
tmux.1
5
tmux.1
@ -5033,6 +5033,11 @@ shell command.
|
|||||||
closes the popup automatically when
|
closes the popup automatically when
|
||||||
.Ar shell-command
|
.Ar shell-command
|
||||||
exits.
|
exits.
|
||||||
|
Two
|
||||||
|
.Fl E
|
||||||
|
closes the popup only if
|
||||||
|
.Ar shell-command
|
||||||
|
exited with success.
|
||||||
With
|
With
|
||||||
.Fl K ,
|
.Fl K ,
|
||||||
.Ql Escape
|
.Ql Escape
|
||||||
|
1
tmux.h
1
tmux.h
@ -2765,6 +2765,7 @@ int menu_display(struct menu *, int, struct cmdq_item *, u_int,
|
|||||||
/* popup.c */
|
/* popup.c */
|
||||||
#define POPUP_WRITEKEYS 0x1
|
#define POPUP_WRITEKEYS 0x1
|
||||||
#define POPUP_CLOSEEXIT 0x2
|
#define POPUP_CLOSEEXIT 0x2
|
||||||
|
#define POPUP_CLOSEEXITZERO 0x4
|
||||||
u_int popup_width(struct cmdq_item *, u_int, const char **,
|
u_int popup_width(struct cmdq_item *, u_int, const char **,
|
||||||
struct client *, struct cmd_find_state *);
|
struct client *, struct cmd_find_state *);
|
||||||
u_int popup_height(u_int, const char **);
|
u_int popup_height(u_int, const char **);
|
||||||
|
Loading…
Reference in New Issue
Block a user