summaryrefslogtreecommitdiffstats
path: root/cmd-kill-window.c
diff options
context:
space:
mode:
authornicm <nicm>2015-05-06 08:35:39 +0000
committernicm <nicm>2015-05-06 08:35:39 +0000
commit31b1ab48521b4b608d87abd5413441905da84da8 (patch)
treed5ea932dbadd29eb8dfc940af46cde28f51a8dca /cmd-kill-window.c
parent33a585c47fcceb55e79a67a5fc47902d6992e68d (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 'cmd-kill-window.c')
-rw-r--r--cmd-kill-window.c17
1 files changed, 5 insertions, 12 deletions
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);
}