summaryrefslogtreecommitdiffstats
path: root/cmd-choose-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-12-30 21:35:17 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-12-30 21:35:17 +0000
commit2231e72968629d67575b18979fed13b4f5ad730b (patch)
tree1271c5ef9fc8239ad20bc16303aa6cf7bbd435e8 /cmd-choose-window.c
parentf7c42c21bacf84af52079b239a18294851fbdb3a (diff)
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.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/cmd-choose-window.c b/cmd-choose-window.c
index 3f4c956b..1bbe0dfe 100644
--- a/cmd-choose-window.c
+++ b/cmd-choose-window.c
@@ -57,7 +57,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) {
@@ -80,20 +80,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;
@@ -103,10 +90,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);