From 13f6d9265a92fe2f1f6baf9d44e58302a55d4baf Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Fri, 11 Nov 2016 20:02:24 -0500 Subject: Respect plugin hook changing tab color Fixup to 241dd69b081 --- src/common/text.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/text.c b/src/common/text.c index 9d7935f2..48b81ea5 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -2009,6 +2009,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d, char *word[PDIWORDS]; int i; tab_state_flags current_state = sess->tab_state; + tab_state_flags plugin_state = sess->last_tab_state; unsigned int stripcolor_args = (chanopt_is_set (prefs.hex_text_stripcolor_msg, sess->text_strip) ? 0xFFFFFFFF : 0); char tbuf[NICKLEN + 4]; @@ -2029,10 +2030,15 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d, /* We want to ignore the tab state if the plugin emits new events * and restore it if it doesn't eat the current one */ - sess->tab_state = sess->last_tab_state; + sess->tab_state = plugin_state; if (plugin_emit_print (sess, word, timestamp)) return; - sess->tab_state = current_state; + + /* The plugin may have changed the state which we should respect. + * If the state is NEW_DATA we don't actually know if that was on + * purpose though as print() sets it, so for now we ignore that. FIXME */ + if (sess->tab_state == plugin_state || sess->tab_state == TAB_STATE_NEW_DATA) + sess->tab_state = current_state; /* If a plugin's callback executes "/close", 'sess' may be invalid */ if (!is_session (sess)) -- cgit 1.4.1