summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-break-pane.c7
-rw-r--r--usr.bin/tmux/cmd-new-session.c5
-rw-r--r--usr.bin/tmux/cmd-rename-window.c5
-rw-r--r--usr.bin/tmux/input.c5
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/window.c10
6 files changed, 22 insertions, 13 deletions
diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c
index 34b109bc358..84f5d982897 100644
--- a/usr.bin/tmux/cmd-break-pane.c
+++ b/usr.bin/tmux/cmd-break-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-break-pane.c,v 1.11 2011/05/08 21:30:00 nicm Exp $ */
+/* $OpenBSD: cmd-break-pane.c,v 1.12 2012/02/02 00:10:11 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,6 +46,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
struct session *s;
struct window_pane *wp;
struct window *w;
+ char *name;
char *cause;
int base_idx;
@@ -74,7 +75,9 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
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");
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 807680ce4f0..8e60c47ddc2 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.39 2011/10/23 08:10:11 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.40 2012/02/02 00:10:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -217,8 +217,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
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);
}
diff --git a/usr.bin/tmux/cmd-rename-window.c b/usr.bin/tmux/cmd-rename-window.c
index e6344a7f070..3e96d827184 100644
--- a/usr.bin/tmux/cmd-rename-window.c
+++ b/usr.bin/tmux/cmd-rename-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-rename-window.c,v 1.6 2011/01/04 00:42:47 nicm Exp $ */
+/* $OpenBSD: cmd-rename-window.c,v 1.7 2012/02/02 00:10:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -48,8 +48,7 @@ cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
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);
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index cd821f488e6..3094a81de9a 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.47 2012/01/21 08:23:12 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.48 2012/02/02 00:10:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1552,8 +1552,7 @@ input_exit_rename(struct input_ctx *ictx)
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);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index cd2741106b0..b5ee73f530d 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.310 2012/01/31 15:52:21 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.311 2012/02/02 00:10:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1968,6 +1968,7 @@ 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 *);
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 *);
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 94eac38e29f..596409acc41 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.71 2012/01/30 09:39:34 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.72 2012/02/02 00:10:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -362,6 +362,14 @@ window_destroy(struct window *w)
}
void
+window_set_name(struct window *w, const char *new_name)
+{
+ if (w->name != NULL)
+ xfree(w->name);
+ w->name = xstrdup(new_name);
+}
+
+void
window_resize(struct window *w, u_int sx, u_int sy)
{
w->sx = sx;