aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2020-03-28 09:51:12 +0000
committernicm <nicm>2020-03-28 09:51:12 +0000
commit593fddf84b6ae661df46597a22107babcc77efd5 (patch)
tree5ef1cb395440658f8b3a2a0c319eb15b5c8ee189
parent4346098e977d8fb3bde0783e9858f3def7bc01a5 (diff)
downloadrtmux-593fddf84b6ae661df46597a22107babcc77efd5.tar.gz
rtmux-593fddf84b6ae661df46597a22107babcc77efd5.tar.bz2
rtmux-593fddf84b6ae661df46597a22107babcc77efd5.zip
Make two -E only close popup automatically if the command exited with 0.
-rw-r--r--popup.c5
-rw-r--r--tmux.15
-rw-r--r--tmux.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/popup.c b/popup.c
index f4afbd85..f2b9bd11 100644
--- a/popup.c
+++ b/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 (KEYC_IS_MOUSE(event->key))
return (0);
- if ((~pd->flags & POPUP_CLOSEEXIT) &&
+ if (((pd->flags & (POPUP_CLOSEEXIT|POPUP_CLOSEEXITZERO)) == 0 ||
+ pd->job == NULL) &&
(event->key == '\033' || event->key == '\003'))
return (1);
if (pd->job == NULL)
@@ -347,6 +348,8 @@ popup_job_complete_cb(struct job *job)
if (pd->flags & POPUP_CLOSEEXIT)
server_client_clear_overlay(pd->c);
+ if ((pd->flags & POPUP_CLOSEEXITZERO) && pd->status == 0)
+ server_client_clear_overlay(pd->c);
}
u_int
diff --git a/tmux.1 b/tmux.1
index aec7f79e..5ee1a5aa 100644
--- a/tmux.1
+++ b/tmux.1
@@ -5032,6 +5032,11 @@ shell command.
closes the popup automatically when
.Ar shell-command
exits.
+Two
+.Fl E
+closes the popup only if
+.Ar shell-command
+exited with success.
With
.Fl K ,
.Ql Escape
diff --git a/tmux.h b/tmux.h
index bcec0a23..a9f4de8a 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2761,6 +2761,7 @@ int menu_display(struct menu *, int, struct cmdq_item *, u_int,
/* popup.c */
#define POPUP_WRITEKEYS 0x1
#define POPUP_CLOSEEXIT 0x2
+#define POPUP_CLOSEEXITZERO 0x4
u_int popup_width(struct cmdq_item *, u_int, const char **,
struct client *, struct cmd_find_state *);
u_int popup_height(u_int, const char **);