summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-choose-window.c25
-rw-r--r--usr.bin/tmux/status.c19
-rw-r--r--usr.bin/tmux/tmux.h4
-rw-r--r--usr.bin/tmux/window.c28
4 files changed, 40 insertions, 36 deletions
diff --git a/usr.bin/tmux/cmd-choose-window.c b/usr.bin/tmux/cmd-choose-window.c
index b8214d1a533..ef69eadc776 100644
--- a/usr.bin/tmux/cmd-choose-window.c
+++ b/usr.bin/tmux/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-window.c,v 1.16 2010/12/20 00:03:55 nicm Exp $ */
+/* $OpenBSD: cmd-choose-window.c,v 1.17 2010/12/30 21:35:17 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index f71a0955864..6c270a27417 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.66 2010/12/11 16:13:15 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.67 2010/12/30 21:35:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -393,21 +393,8 @@ status_replace1(struct client *c,struct winlink *wl,
ptr = wl->window->name;
goto do_replace;
case 'F':
- tmp[0] = ' ';
- if (wl->flags & WINLINK_CONTENT)
- tmp[0] = '+';
- else if (wl->flags & WINLINK_BELL)
- tmp[0] = '!';
- else if (wl->flags & WINLINK_ACTIVITY)
- tmp[0] = '#';
- else if (wl->flags & WINLINK_SILENCE)
- tmp[0] = '~';
- else if (wl == s->curw)
- tmp[0] = '*';
- else if (wl == TAILQ_FIRST(&s->lastw))
- tmp[0] = '-';
- tmp[1] = '\0';
- ptr = tmp;
+ ptr = window_printable_flags(s, wl);
+ freeptr = ptr;
goto do_replace;
case '[':
/*
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index bd7efdf2c09..baff10ffda6 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.255 2010/12/29 21:49:06 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.256 2010/12/30 21:35:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1898,6 +1898,8 @@ void window_pane_mouse(struct window_pane *,
int window_pane_visible(struct window_pane *);
char *window_pane_search(
struct window_pane *, const char *, u_int *);
+char *window_printable_flags(struct session *, struct winlink *);
+
struct window_pane *window_pane_find_up(struct window_pane *);
struct window_pane *window_pane_find_down(struct window_pane *);
struct window_pane *window_pane_find_left(struct window_pane *);
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 3a4dca028cc..19ddf942176 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.60 2010/12/06 22:51:02 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.61 2010/12/30 21:35:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -463,6 +463,32 @@ window_destroy_panes(struct window *w)
}
}
+/* Return list of printable window flag symbols. No flags is just a space. */
+char *
+window_printable_flags(struct session *s, struct winlink *wl)
+{
+ char flags[BUFSIZ];
+ int pos;
+
+ pos = 0;
+ if (wl->flags & WINLINK_ACTIVITY)
+ flags[pos++] = '#';
+ if (wl->flags & WINLINK_BELL)
+ flags[pos++] = '!';
+ if (wl->flags & WINLINK_CONTENT)
+ flags[pos++] = '+';
+ if (wl->flags & WINLINK_SILENCE)
+ flags[pos++] = '~';
+ if (wl == s->curw)
+ flags[pos++] = '*';
+ if (wl == TAILQ_FIRST(&s->lastw))
+ flags[pos++] = '-';
+ if (pos == 0)
+ flags[pos++] = ' ';
+ flags[pos] = '\0';
+ return (xstrdup(flags));
+}
+
struct window_pane *
window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
{