From 31b1ab48521b4b608d87abd5413441905da84da8 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 6 May 2015 08:35:39 +0000 Subject: 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. --- cmd-kill-window.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'cmd-kill-window.c') diff --git a/cmd-kill-window.c b/cmd-kill-window.c index d402acce..4d346a71 100644 --- a/cmd-kill-window.c +++ b/cmd-kill-window.c @@ -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); } -- cgit