summaryrefslogtreecommitdiffstats
path: root/cmd-choose-window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-01-07 16:55:40 +0000
committerTiago Cunha <tcunha@gmx.com>2011-01-07 16:55:40 +0000
commit30f6d9b167907783122869100046954e52c07694 (patch)
tree16dfc3e30982c4155458349b9b6fb3e5bf8da5b0 /cmd-choose-window.c
parent1cb579d0fdf5eab42866c3d2d01ab6f2f87b3cbb (diff)
Sync OpenBSD patchset 813:
Add a function to create window flags rather than doing the same thing in two places. From Thomas Adam.
Diffstat (limited to 'cmd-choose-window.c')
-rw-r--r--cmd-choose-window.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/cmd-choose-window.c b/cmd-choose-window.c
index 04360ec4..dce71c1a 100644
--- a/cmd-choose-window.c
+++ b/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-window.c,v 1.25 2011-01-07 14:45:33 tcunha Exp $ */
+/* $Id: cmd-choose-window.c,v 1.26 2011-01-07 16:55:40 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,7 +56,7 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct winlink *wl, *wm;
struct window *w;
u_int idx, cur;
- char flag, *title;
+ char *flags, *title;
const char *left, *right;
if (ctx->curclient == NULL) {
@@ -79,20 +79,7 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
cur = idx;
idx++;
- flag = ' ';
- if (wm->flags & WINLINK_ACTIVITY)
- flag = '#';
- else if (wm->flags & WINLINK_BELL)
- flag = '!';
- else if (wm->flags & WINLINK_CONTENT)
- flag = '+';
- else if (wm->flags & WINLINK_SILENCE)
- flag = '~';
- else if (wm == s->curw)
- flag = '*';
- else if (wm == TAILQ_FIRST(&s->lastw))
- flag = '-';
-
+ flags = window_printable_flags(s, wm);
title = w->active->screen->title;
if (wm == wl)
title = w->active->base.title;
@@ -102,10 +89,12 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
left = right = "";
window_choose_add(wl->window->active,
- wm->idx, "%3d: %s%c [%ux%u] (%u panes%s)%s%s%s",
- wm->idx, w->name, flag, w->sx, w->sy, window_count_panes(w),
+ wm->idx, "%3d: %s%s [%ux%u] (%u panes%s)%s%s%s",
+ wm->idx, w->name, flags, w->sx, w->sy, window_count_panes(w),
w->active->fd == -1 ? ", dead" : "",
left, title, right);
+
+ xfree(flags);
}
cdata = xmalloc(sizeof *cdata);