aboutsummaryrefslogtreecommitdiff
path: root/names.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2013-02-22 16:25:50 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2013-02-22 16:25:50 +0000
commitce7bf1083edd5679420d5288ae53a52759e0d51c (patch)
treeb374f41806da66441a5ca5b69eba0f683e6b2f17 /names.c
parent1db4ec6e6327aa4b879e42f5e37a2c599f487206 (diff)
parent1c82cf76608d7e87d734414ddba6e76622b9646c (diff)
downloadrtmux-ce7bf1083edd5679420d5288ae53a52759e0d51c.tar.gz
rtmux-ce7bf1083edd5679420d5288ae53a52759e0d51c.tar.bz2
rtmux-ce7bf1083edd5679420d5288ae53a52759e0d51c.zip
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'names.c')
-rw-r--r--names.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/names.c b/names.c
index f536d2fc..bcb6aafe 100644
--- a/names.c
+++ b/names.c
@@ -26,8 +26,8 @@
#include "tmux.h"
-void window_name_callback(unused int, unused short, void *);
-char *parse_window_name(const char *);
+void window_name_callback(int, short, void *);
+char *parse_window_name(struct window *, const char *);
void
queue_window_name(struct window *w)
@@ -73,9 +73,9 @@ window_name_callback(unused int fd, unused short events, void *data)
*/
if (w->active->cmd != NULL && *w->active->cmd == '\0' &&
name != NULL && name[0] == '-' && name[1] != '\0')
- wname = parse_window_name(name + 1);
+ wname = parse_window_name(w, name + 1);
else
- wname = parse_window_name(name);
+ wname = parse_window_name(w, name);
free(name);
}
@@ -98,18 +98,22 @@ default_window_name(struct window *w)
if (w->active->screen != &w->active->base)
return (xstrdup("[tmux]"));
if (w->active->cmd != NULL && *w->active->cmd != '\0')
- return (parse_window_name(w->active->cmd));
- return (parse_window_name(w->active->shell));
+ return (parse_window_name(w, w->active->cmd));
+ return (parse_window_name(w, w->active->shell));
}
char *
-parse_window_name(const char *in)
+parse_window_name(struct window *w, const char *in)
{
- char *copy, *name, *ptr;
+ char *copy, *name, *ptr, *prefix;
+ size_t prefixlen;
+
+ prefix = options_get_string(&w->options, "command-prefix");
+ prefixlen = strlen(prefix);
name = copy = xstrdup(in);
- if (strncmp(name, "exec ", (sizeof "exec ") - 1) == 0)
- name = name + (sizeof "exec ") - 1;
+ if (strncmp(name, prefix, prefixlen) == 0)
+ name = name + prefixlen;
while (*name == ' ')
name++;