Applied this to OpenBSD which is your change with a few minor changes.

Index: cmd-choose-window.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/cmd-choose-window.c,v
retrieving revision 1.16
diff -u -p -r1.16 cmd-choose-window.c
--- cmd-choose-window.c 20 Dec 2010 00:03:55 -0000      1.16
+++ cmd-choose-window.c 30 Dec 2010 21:34:44 -0000
@@ -57,7 +57,7 @@ cmd_choose_window_exec(struct cmd *self,
        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,
                        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,
                        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);
Index: status.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/status.c,v
retrieving revision 1.66
diff -u -p -r1.66 status.c
--- status.c    11 Dec 2010 16:13:15 -0000      1.66
+++ status.c    30 Dec 2010 21:34:45 -0000
@@ -393,21 +393,8 @@ status_replace1(struct client *c,struct 
                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 '[':
                /*
Index: tmux.h
===================================================================
RCS file: /cvs/src/usr.bin/tmux/tmux.h,v
retrieving revision 1.255
diff -u -p -r1.255 tmux.h
--- tmux.h      29 Dec 2010 21:49:06 -0000      1.255
+++ tmux.h      30 Dec 2010 21:34:46 -0000
@@ -1898,6 +1898,8 @@ void               window_pane_mouse(struct window_p
 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 *);
Index: window.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/window.c,v
retrieving revision 1.60
diff -u -p -r1.60 window.c
--- window.c    6 Dec 2010 22:51:02 -0000       1.60
+++ window.c    30 Dec 2010 21:34:46 -0000
@@ -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)
 {



On Tue, Dec 28, 2010 at 11:11:54PM +0000, Thomas Adam wrote:
> On Tue, Dec 28, 2010 at 07:41:28PM +0000, Nicholas Marriott wrote:
> > I'm not convinced about showing multiple flags in the status line but I
> > need to give it a go and see. It'll probably be fine, I hardly ever have
> > more than one flag on any window.
> 
> Try it and see if anyone screams?  ;)  I won't be changing anything about
> that patch to do with window flags, so feel free to take those.  Unless I
> hear otherwise, I'll still be assuming I can use printable_window_flags()
> even if the functionality of it changes to return just one flag.
> 
> -- Thomas Adam
> 
> -- 
> "It was the cruelest game I've ever played and it's played inside my head."
> -- "Hush The Warmth", Gorky's Zygotic Mynci.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to