summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-08-28 17:11:13 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-08-28 17:11:13 +0000
commit40b00a0e0da1f1f6adbbc32c5a9ac08f118368e3 (patch)
treec424165c0184156181a977c254f0eb34cfe776a4 /usr.bin/tmux/window.c
parentd9aff2304ad1d92e7fa0777cf9d777451293c3e8 (diff)
Only set default title to hostname on screens that are being used for a
window pane, no point in calling gethostname() for temporary screens.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 946facedb0d..6142013d9f8 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.139 2015/08/28 16:10:46 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.140 2015/08/28 17:11:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -704,6 +704,7 @@ struct window_pane *
window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
{
struct window_pane *wp;
+ char host[HOST_NAME_MAX + 1];
wp = xcalloc(1, sizeof *wp);
wp->window = w;
@@ -740,6 +741,9 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
screen_init(&wp->base, sx, sy, hlimit);
wp->screen = &wp->base;
+ if (gethostname(host, sizeof host) == 0)
+ screen_set_title(&wp->base, host);
+
input_init(wp);
return (wp);