Hi I've applied this, thanks.
I'll do the list-windows target, but I need to get some time to fiddle about and see how to do it, I can't decide on a nice way yet. On Tue, Jan 31, 2012 at 07:50:24PM -0800, George Nachman wrote: > This patch replaces the repeated pattern of freeing a window name and > setting it to a strdup'ed value with a function. It lays the trail for > a future patch which adds a control client notification when windows > are renamed. > > Do you want me to send a patch for the list-windows target or are you > handling that? I'm not exactly sure how you wanted that to work. > > Index: tmux.h > =================================================================== > --- tmux.h (revision 2691) > +++ tmux.h (working copy) > @@ -1964,6 +1964,7 @@ > struct window_pane *window_pane_find_down(struct window_pane *); > struct window_pane *window_pane_find_left(struct window_pane *); > struct window_pane *window_pane_find_right(struct window_pane *); > +void window_set_name(struct window *, const char *); > > /* layout.c */ > u_int layout_count_cells(struct layout_cell *); > Index: cmd-new-session.c > =================================================================== > --- cmd-new-session.c (revision 2691) > +++ cmd-new-session.c (working copy) > @@ -217,8 +217,7 @@ > if (cmd != NULL && args_has(args, 'n')) { > w = s->curw->window; > > - xfree(w->name); > - w->name = xstrdup(args_get(args, 'n')); > + window_set_name(w, args_get(args, 'n')); > > options_set_number(&w->options, "automatic-rename", 0); > } > Index: cmd-break-pane.c > =================================================================== > --- cmd-break-pane.c (revision 2691) > +++ cmd-break-pane.c (working copy) > @@ -46,8 +46,10 @@ > struct session *s; > struct window_pane *wp; > struct window *w; > + char *name; > char *cause; > int base_idx; > + struct client *c; > > if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) > return (-1); > @@ -74,7 +76,9 @@ > w = wp->window = window_create1(s->sx, s->sy); > TAILQ_INSERT_HEAD(&w->panes, wp, entry); > w->active = wp; > - w->name = default_window_name(w); > + name = default_window_name(w); > + window_set_name(w, name); > + xfree(name); > layout_init(w); > > base_idx = options_get_number(&s->options, "base-index"); > Index: cmd-rename-window.c > =================================================================== > --- cmd-rename-window.c (revision 2691) > +++ cmd-rename-window.c (working copy) > @@ -48,8 +48,7 @@ > if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL) > return (-1); > > - xfree(wl->window->name); > - wl->window->name = xstrdup(args->argv[0]); > + window_set_name(wl->window, args->argv[0]); > options_set_number(&wl->window->options, "automatic-rename", 0); > > server_status_window(wl->window); > Index: input.c > =================================================================== > --- input.c (revision 2691) > +++ input.c (working copy) > @@ -1036,7 +1036,7 @@ > struct window_pane *wp = ictx->wp; > struct screen *s = sctx->s; > struct input_table_entry *entry; > - int n, m; > + int n, m; > > if (ictx->flags & INPUT_DISCARD) > return (0); > @@ -1552,8 +1552,7 @@ > return; > log_debug("%s: \"%s\"", __func__, ictx->input_buf); > > - xfree(ictx->wp->window->name); > - ictx->wp->window->name = xstrdup(ictx->input_buf); > + window_set_name(ictx->wp->window, ictx->input_buf); > options_set_number(&ictx->wp->window->options, "automatic-rename", 0); > > server_status_window(ictx->wp->window); > Index: window.c > =================================================================== > --- window.c (revision 2691) > +++ window.c (working copy) > @@ -359,6 +359,14 @@ > } > > void > +window_set_name(struct window *w, const char *new_name) > +{ > + if (w->name) > + xfree(w->name); > + w->name = xstrdup(new_name); > +} > + > +void > window_resize(struct window *w, u_int sx, u_int sy) > { > w->sx = sx; > @@ -760,7 +768,7 @@ > window_pane_read_callback(unused struct bufferevent *bufev, void *data) > { > struct window_pane *wp = data; > - char *new_data; > + char *new_data; > size_t new_size; > > new_size = EVBUFFER_LENGTH(wp->event->input) - wp->pipe_off; > @@ -992,7 +1000,7 @@ > { > struct screen *s = &wp->base; > char *newsearchstr, *line, *msg; > - u_int i; > + u_int i; > > msg = NULL; > xasprintf(&newsearchstr, "*%s*", searchstr); > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > tmux-users mailing list > tmux-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tmux-users ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users