diff --git a/cmd-split-window.c b/cmd-split-window.c index 6b0fb9ea..e65a0296 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -38,7 +38,7 @@ const struct cmd_entry cmd_new_pane_entry = { .name = "new-pane", .alias = "newp", - .args = { "bc:de:fF:hIkl:Lm:p:PR:s:S:t:vx:X:y:Y:Z", 0, -1, NULL }, + .args = { "bc:de:EfF:hIkl:Lm:p:PR:s:S:t:vx:X:y:Y:Z", 0, -1, NULL }, .usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] " "[-F format] [-l size] [-m message] [-p percentage] " "[-s style] [-S active-border-style] " @@ -56,7 +56,7 @@ const struct cmd_entry cmd_split_window_entry = { .name = "split-window", .alias = "splitw", - .args = { "bc:de:fF:hIkl:m:p:PR:s:S:t:vZ", 0, -1, NULL }, + .args = { "bc:de:EfF:hIkl:m:p:PR:s:S:t:vZ", 0, -1, NULL }, .usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] " "[-F format] [-l size] [-m message] [-p percentage] " "[-s style] [-S active-border-style] " @@ -83,7 +83,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) struct window_pane *wp = target->wp, *new_wp; struct layout_cell *lc = NULL; struct cmd_find_state fs; - int input, is_floating, flags = 0; + int input, empty, is_floating, flags = 0; const char *template, *style; char *cause = NULL, *cp; struct args_value *av; @@ -93,14 +93,20 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) is_floating = !args_has(args, 'L'); else is_floating = 0; - input = (args_has(args, 'I') && count == 0); flags = is_floating ? SPAWN_FLOATING : 0; if (args_has(args, 'b')) flags |= SPAWN_BEFORE; if (args_has(args, 'f')) flags |= SPAWN_FULLSIZE; - if (input || (count == 1 && *args_string(args, 0) == '\0')) + + input = args_has(args, 'I'); + empty = (count == 1 && *args_string(args, 0) == '\0'); + if (!empty && (input || args_has(args, 'E'))) { + cmdq_error(item, "command cannot be given for empty pane"); + return (CMD_RETURN_ERROR); + } + if (input || empty || args_has(args, 'E')) flags |= SPAWN_EMPTY; if (is_floating) diff --git a/tmux.1 b/tmux.1 index ea776195..db2d0ebe 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3379,15 +3379,16 @@ but also sets the option for this pane to .Ar message . .Pp -An empty -.Ar shell\-command -(\[aq]\[aq]) will create a pane with no command running in it. +.Fl E , +or an empty +.Ar shell\-command , +(\[aq]\[aq]) will create an empty pane with no command running in it; +.Ic display-message +.Fl I +can write to an empty pane. The .Fl I -flag (if -.Ar shell\-command -is not specified or empty) -will create an empty pane and forward any output from stdin to it. +flag will create an empty pane and forward any output from stdin to it. For example: .Bd -literal -offset indent $ make 2>&1|tmux splitw \-dI &