mirror of
https://github.com/tmux/tmux.git
synced 2025-09-06 00:37:06 +00:00
Add -k flag to display-popup which allows any key to dismiss the popup
once the command has exited. From Meriel Luna Mittelbach in GitHub issue 4612.
This commit is contained in:
@ -55,8 +55,8 @@ const struct cmd_entry cmd_display_popup_entry = {
|
|||||||
.name = "display-popup",
|
.name = "display-popup",
|
||||||
.alias = "popup",
|
.alias = "popup",
|
||||||
|
|
||||||
.args = { "Bb:Cc:d:e:Eh:s:S:t:T:w:x:y:", 0, -1, NULL },
|
.args = { "Bb:Cc:d:e:Eh:ks:S:t:T:w:x:y:", 0, -1, NULL },
|
||||||
.usage = "[-BCE] [-b border-lines] [-c target-client] "
|
.usage = "[-BCEk] [-b border-lines] [-c target-client] "
|
||||||
"[-d start-directory] [-e environment] [-h height] "
|
"[-d start-directory] [-e environment] [-h height] "
|
||||||
"[-s style] [-S border-style] " CMD_TARGET_PANE_USAGE
|
"[-s style] [-S border-style] " CMD_TARGET_PANE_USAGE
|
||||||
" [-T title] [-w width] [-x position] [-y position] "
|
" [-T title] [-w width] [-x position] [-y position] "
|
||||||
@ -485,6 +485,8 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
flags |= POPUP_CLOSEEXITZERO;
|
flags |= POPUP_CLOSEEXITZERO;
|
||||||
else if (args_has(args, 'E'))
|
else if (args_has(args, 'E'))
|
||||||
flags |= POPUP_CLOSEEXIT;
|
flags |= POPUP_CLOSEEXIT;
|
||||||
|
if (args_has(args, 'k'))
|
||||||
|
flags |= POPUP_CLOSEANYKEY;
|
||||||
if (popup_display(flags, lines, item, px, py, w, h, env, shellcmd, argc,
|
if (popup_display(flags, lines, item, px, py, w, h, env, shellcmd, argc,
|
||||||
argv, cwd, title, tc, s, style, border_style, NULL, NULL) != 0) {
|
argv, cwd, title, tc, s, style, border_style, NULL, NULL) != 0) {
|
||||||
cmd_free_argv(argc, argv);
|
cmd_free_argv(argc, argv);
|
||||||
|
3
popup.c
3
popup.c
@ -549,6 +549,9 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
|
|||||||
pd->job == NULL) &&
|
pd->job == NULL) &&
|
||||||
(event->key == '\033' || event->key == ('c'|KEYC_CTRL)))
|
(event->key == '\033' || event->key == ('c'|KEYC_CTRL)))
|
||||||
return (1);
|
return (1);
|
||||||
|
if (pd->job == NULL && (pd->flags & POPUP_CLOSEANYKEY) &&
|
||||||
|
!KEYC_IS_MOUSE(event->key) && !KEYC_IS_PASTE(event->key))
|
||||||
|
return (1);
|
||||||
if (pd->job != NULL) {
|
if (pd->job != NULL) {
|
||||||
if (KEYC_IS_MOUSE(event->key)) {
|
if (KEYC_IS_MOUSE(event->key)) {
|
||||||
/* Must be inside, checked already. */
|
/* Must be inside, checked already. */
|
||||||
|
7
tmux.1
7
tmux.1
@ -6967,7 +6967,7 @@ forwards any input read from stdin to the empty pane given by
|
|||||||
.Ar target-pane .
|
.Ar target-pane .
|
||||||
.Tg popup
|
.Tg popup
|
||||||
.It Xo Ic display-popup
|
.It Xo Ic display-popup
|
||||||
.Op Fl BCE
|
.Op Fl BCEk
|
||||||
.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 d Ar start-directory
|
.Op Fl d Ar start-directory
|
||||||
@ -7001,6 +7001,11 @@ Two
|
|||||||
closes the popup only if
|
closes the popup only if
|
||||||
.Ar shell-command
|
.Ar shell-command
|
||||||
exited with success.
|
exited with success.
|
||||||
|
.Fl k
|
||||||
|
allows any key to dismiss the popup instead of only
|
||||||
|
.Ql Escape
|
||||||
|
or
|
||||||
|
.Ql C-c .
|
||||||
.Pp
|
.Pp
|
||||||
.Fl x
|
.Fl x
|
||||||
and
|
and
|
||||||
|
9
tmux.h
9
tmux.h
@ -1543,10 +1543,10 @@ struct tty {
|
|||||||
#define TTY_SYNCING 0x400
|
#define TTY_SYNCING 0x400
|
||||||
#define TTY_HAVEDA2 0x800
|
#define TTY_HAVEDA2 0x800
|
||||||
#define TTY_WINSIZEQUERY 0x1000
|
#define TTY_WINSIZEQUERY 0x1000
|
||||||
#define TTY_HAVEFG 0x2000
|
#define TTY_WAITFG 0x2000
|
||||||
#define TTY_HAVEBG 0x4000
|
#define TTY_WAITBG 0x4000
|
||||||
#define TTY_ALL_REQUEST_FLAGS \
|
#define TTY_ALL_REQUEST_FLAGS \
|
||||||
(TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA|TTY_HAVEFG|TTY_HAVEBG)
|
(TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA)
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
struct tty_term *term;
|
struct tty_term *term;
|
||||||
@ -2474,7 +2474,7 @@ void tty_set_size(struct tty *, u_int, u_int, u_int, u_int);
|
|||||||
void tty_invalidate(struct tty *);
|
void tty_invalidate(struct tty *);
|
||||||
void tty_start_tty(struct tty *);
|
void tty_start_tty(struct tty *);
|
||||||
void tty_send_requests(struct tty *);
|
void tty_send_requests(struct tty *);
|
||||||
void tty_repeat_requests(struct tty *);
|
void tty_repeat_requests(struct tty *, int);
|
||||||
void tty_stop_tty(struct tty *);
|
void tty_stop_tty(struct tty *);
|
||||||
void tty_set_title(struct tty *, const char *);
|
void tty_set_title(struct tty *, const char *);
|
||||||
void tty_set_path(struct tty *, const char *);
|
void tty_set_path(struct tty *, const char *);
|
||||||
@ -3523,6 +3523,7 @@ int menu_key_cb(struct client *, void *, struct key_event *);
|
|||||||
#define POPUP_CLOSEEXIT 0x1
|
#define POPUP_CLOSEEXIT 0x1
|
||||||
#define POPUP_CLOSEEXITZERO 0x2
|
#define POPUP_CLOSEEXITZERO 0x2
|
||||||
#define POPUP_INTERNAL 0x4
|
#define POPUP_INTERNAL 0x4
|
||||||
|
#define POPUP_CLOSEANYKEY 0x8
|
||||||
typedef void (*popup_close_cb)(int, void *);
|
typedef void (*popup_close_cb)(int, void *);
|
||||||
typedef void (*popup_finish_edit_cb)(char *, size_t, void *);
|
typedef void (*popup_finish_edit_cb)(char *, size_t, void *);
|
||||||
int popup_display(int, enum box_lines, struct cmdq_item *, u_int,
|
int popup_display(int, enum box_lines, struct cmdq_item *, u_int,
|
||||||
|
Reference in New Issue
Block a user