From fc58e44f89b876aa051f849361bc215c1f965696 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 28 Aug 2015 07:49:24 +0000 Subject: [PATCH 1/2] Only do the automatic-rename dance if the pane has changed (seen output, or new active pane). --- input.c | 2 ++ names.c | 4 ++++ tmux.h | 1 + window.c | 1 + 4 files changed, 8 insertions(+) diff --git a/input.c b/input.c index 7a334810..7ec35c88 100644 --- a/input.c +++ b/input.c @@ -844,6 +844,8 @@ input_parse(struct window_pane *wp) if (EVBUFFER_LENGTH(evb) == 0) return; + wp->flags |= PANE_CHANGED; + wp->window->flags |= WINDOW_ACTIVITY; wp->window->flags &= ~WINDOW_SILENCE; diff --git a/names.c b/names.c index 1ceb83c0..0a3af903 100644 --- a/names.c +++ b/names.c @@ -50,6 +50,10 @@ window_name_callback(unused int fd, unused short events, void *data) if (w->active == NULL) return; + if (~w->active->flags & PANE_CHANGED) + return; + w->active->flags &= ~PANE_CHANGED; + if (!options_get_number(&w->options, "automatic-rename")) { if (event_initialized(&w->name_timer)) event_del(&w->name_timer); diff --git a/tmux.h b/tmux.h index 0f9cb26e..2d0ccede 100644 --- a/tmux.h +++ b/tmux.h @@ -826,6 +826,7 @@ struct window_pane { #define PANE_RESIZE 0x8 #define PANE_FOCUSPUSH 0x10 #define PANE_INPUTOFF 0x20 +#define PANE_CHANGED 0x40 int argc; char **argv; diff --git a/window.c b/window.c index 6351eff5..395574f7 100644 --- a/window.c +++ b/window.c @@ -412,6 +412,7 @@ window_set_active_pane(struct window *w, struct window_pane *wp) return (1); } w->active->active_point = next_active_point++; + w->active->flags |= PANE_CHANGED; return (1); } From 25faca41eb30bc7cba95da0103bfa6fdda4d9a8b Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 28 Aug 2015 07:55:43 +0000 Subject: [PATCH 2/2] Error messages should not have a trailing period. --- server-window.c | 2 +- window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server-window.c b/server-window.c index 1b3938d3..c96c2602 100644 --- a/server-window.c +++ b/server-window.c @@ -147,7 +147,7 @@ server_window_check_silence(struct session *s, struct winlink *wl) * from this window. */ if (gettimeofday(&w->silence_timer, NULL) != 0) - fatal("gettimeofday failed."); + fatal("gettimeofday failed"); return (0); } diff --git a/window.c b/window.c index 395574f7..77c7a633 100644 --- a/window.c +++ b/window.c @@ -934,7 +934,7 @@ window_pane_read_callback(unused struct bufferevent *bufev, void *data) */ wp->window->flags |= WINDOW_SILENCE; if (gettimeofday(&wp->window->silence_timer, NULL) != 0) - fatal("gettimeofday failed."); + fatal("gettimeofday failed"); return; start_timer: