diff options
author | 2020-04-22 21:15:33 +0000 | |
---|---|---|
committer | 2020-04-22 21:15:33 +0000 | |
commit | b196a1a7bcd85fa2d2eacd03789d76a3e0990931 (patch) | |
tree | b9f93dac7a5a4a6dce2b12c4bd6d6cd9d4516dec /usr.bin/tmux/cmd-move-window.c | |
parent | Indicate the marked pane in choose mode in reverse and add key to set (diff) | |
download | wireguard-openbsd-b196a1a7bcd85fa2d2eacd03789d76a3e0990931.tar.xz wireguard-openbsd-b196a1a7bcd85fa2d2eacd03789d76a3e0990931.zip |
Improve join-pane, move-pane and break-pane:
- There is no need for join-pane and move-pane to be different.
- break-pane can just behave like move-window if the source has only one
pane, instead of failing.
- Add -a to break-pane like move-window.
Also add missing man page bits for previous window-tree.c changes.
GitHub issue 2176.
Diffstat (limited to 'usr.bin/tmux/cmd-move-window.c')
-rw-r--r-- | usr.bin/tmux/cmd-move-window.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c index 9f22f40f43b..c5df28f4fda 100644 --- a/usr.bin/tmux/cmd-move-window.c +++ b/usr.bin/tmux/cmd-move-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-move-window.c,v 1.31 2020/04/13 10:59:58 nicm Exp $ */ +/* $OpenBSD: cmd-move-window.c,v 1.32 2020/04/22 21:15:33 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -63,9 +63,9 @@ cmd_move_window_exec(struct cmd *self, struct cmdq_item *item) struct cmd_find_state *source = cmdq_get_source(item); struct cmd_find_state target; const char *tflag = args_get(args, 't'); - struct session *src; + struct session *src = source->s; struct session *dst; - struct winlink *wl; + struct winlink *wl = source->wl; char *cause; int idx, kflag, dflag, sflag; @@ -83,9 +83,7 @@ cmd_move_window_exec(struct cmd *self, struct cmdq_item *item) if (cmd_find_target(&target, item, tflag, CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX) != 0) return (CMD_RETURN_ERROR); - src = source->s; dst = target.s; - wl = source->wl; idx = target.idx; kflag = args_has(args, 'k'); @@ -93,12 +91,16 @@ cmd_move_window_exec(struct cmd *self, struct cmdq_item *item) sflag = args_has(args, 's'); if (args_has(args, 'a')) { - if ((idx = winlink_shuffle_up(dst, dst->curw)) == -1) + if (target.wl != NULL) + idx = winlink_shuffle_up(dst, target.wl); + else + idx = winlink_shuffle_up(dst, dst->curw); + if (idx == -1) return (CMD_RETURN_ERROR); } if (server_link_window(src, wl, dst, idx, kflag, !dflag, &cause) != 0) { - cmdq_error(item, "can't link window: %s", cause); + cmdq_error(item, "%s", cause); free(cause); return (CMD_RETURN_ERROR); } |