diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-05-06 08:35:40 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-05-06 08:35:40 +0000 |
commit | 6b482673b9d403f6307339c97efc44eb02a1fa23 (patch) | |
tree | 2b7d252c92d22f04e5a09bbfe419a373144d2871 /usr.bin/tmux/cmd-kill-window.c | |
parent | a19da5438d0b55c7f7b1f116d939dd84d8cf7a06 (diff) |
Add a format window_linked which is 1 if a window has been linked
multiple times, also remove the default space in window_flags and use a
conditional to add it in window-status-format (this means additional
flags can be added in the option without extra spaces). From Thomas Adam
with tweaks by me.
Diffstat (limited to 'usr.bin/tmux/cmd-kill-window.c')
-rw-r--r-- | usr.bin/tmux/cmd-kill-window.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c index c5f08fda15e..499929c0744 100644 --- a/usr.bin/tmux/cmd-kill-window.c +++ b/usr.bin/tmux/cmd-kill-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-window.c,v 1.16 2014/10/22 23:11:41 nicm Exp $ */ +/* $OpenBSD: cmd-kill-window.c,v 1.17 2015/05/06 08:35:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -45,24 +45,17 @@ const struct cmd_entry cmd_unlink_window_entry = { enum cmd_retval cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq) { - struct args *args = self->args; - struct winlink *wl, *wl2, *wl3; - struct window *w; - struct session *s; - struct session_group *sg; - u_int references; + struct args *args = self->args; + struct winlink *wl, *wl2, *wl3; + struct window *w; + struct session *s; if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL) return (CMD_RETURN_ERROR); w = wl->window; if (self->entry == &cmd_unlink_window_entry) { - sg = session_group_find(s); - if (sg != NULL) - references = session_group_count(sg); - else - references = 1; - if (!args_has(self->args, 'k') && w->references == references) { + if (!args_has(self->args, 'k') && !session_is_linked(s, w)) { cmdq_error(cmdq, "window only linked to one session"); return (CMD_RETURN_ERROR); } |