mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Hilight fixes - mode lines shouldn't be hilighted accidentally anymore.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1633 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
27fcabbc19
commit
118b5f48a2
@ -167,8 +167,9 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
||||
window_item_window((WI_ITEM_REC *) chanrec)->items->next != NULL)
|
||||
print_channel = TRUE;
|
||||
|
||||
level = MSGLEVEL_PUBLIC | (for_me || color != NULL ?
|
||||
MSGLEVEL_HILIGHT : MSGLEVEL_NOHILIGHT);
|
||||
level = MSGLEVEL_PUBLIC;
|
||||
if (for_me || color != NULL)
|
||||
level |= MSGLEVEL_HILIGHT;
|
||||
|
||||
if (settings_get_bool("emphasis"))
|
||||
msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg);
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "formats.h"
|
||||
|
||||
static NICKMATCH_REC *nickmatch;
|
||||
static HILIGHT_REC *next_nick_hilight;
|
||||
static int never_hilight_level, default_hilight_level;
|
||||
GSList *hilights;
|
||||
|
||||
@ -281,42 +280,28 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
||||
{
|
||||
HILIGHT_REC *hilight;
|
||||
char *color, *newstr;
|
||||
int hilight_start, hilight_end, hilight_len;
|
||||
int old_level, hilight_start, hilight_end, hilight_len;
|
||||
|
||||
if (dest->level & MSGLEVEL_NOHILIGHT)
|
||||
return;
|
||||
|
||||
hilight_start = hilight_end = 0;
|
||||
if (next_nick_hilight != NULL) {
|
||||
if (!next_nick_hilight->nick) {
|
||||
/* non-nick hilight wanted */
|
||||
hilight = next_nick_hilight;
|
||||
next_nick_hilight = NULL;
|
||||
if (!hilight_match_text(hilight, stripped,
|
||||
&hilight_start,
|
||||
&hilight_end)) {
|
||||
hilight_start = 0;
|
||||
hilight_end = strlen(stripped);
|
||||
}
|
||||
} else {
|
||||
/* nick is highlighted, just set priority */
|
||||
hilight_update_text_dest(dest, next_nick_hilight);
|
||||
next_nick_hilight = NULL;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (dest->level & (MSGLEVEL_NOHILIGHT|MSGLEVEL_HILIGHT))
|
||||
return;
|
||||
|
||||
hilight = hilight_match(dest->server, dest->target,
|
||||
NULL, NULL, dest->level, stripped,
|
||||
&hilight_start,
|
||||
&hilight_end);
|
||||
}
|
||||
|
||||
hilight = hilight_match(dest->server, dest->target,
|
||||
NULL, NULL, dest->level, stripped,
|
||||
&hilight_start,
|
||||
&hilight_end);
|
||||
if (hilight == NULL)
|
||||
return;
|
||||
|
||||
/* update the level / hilight info */
|
||||
old_level = dest->level;
|
||||
hilight_update_text_dest(dest, hilight);
|
||||
|
||||
if (old_level & MSGLEVEL_HILIGHT) {
|
||||
/* nick is highlighted, just set priority */
|
||||
return;
|
||||
}
|
||||
|
||||
color = hilight_get_color(hilight);
|
||||
hilight_len = hilight_end-hilight_start;
|
||||
|
||||
@ -387,7 +372,6 @@ char *hilight_match_nick(SERVER_REC *server, const char *channel,
|
||||
color = rec == NULL || !rec->nick ? NULL :
|
||||
hilight_get_color(rec);
|
||||
|
||||
next_nick_hilight = rec;
|
||||
return color;
|
||||
}
|
||||
|
||||
@ -557,16 +541,14 @@ static void cmd_hilight(const char *data)
|
||||
rec->regexp = g_hash_table_lookup(optlist, "regexp") != NULL;
|
||||
|
||||
if (colorarg != NULL) {
|
||||
g_free_and_null(rec->color);
|
||||
if (*colorarg != '\0')
|
||||
rec->color = g_strdup(colorarg);
|
||||
else
|
||||
g_free_and_null(rec->color);
|
||||
}
|
||||
if (actcolorarg != NULL) {
|
||||
g_free_and_null(rec->act_color);
|
||||
if (*actcolorarg != '\0')
|
||||
rec->act_color = g_strdup(actcolorarg);
|
||||
else
|
||||
g_free_and_null(rec->act_color);
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@ -654,8 +636,6 @@ void hilight_text_init(void)
|
||||
settings_add_str("lookandfeel", "hilight_act_color", "%M");
|
||||
settings_add_str("lookandfeel", "hilight_level", "PUBLIC DCCMSGS");
|
||||
|
||||
next_nick_hilight = NULL;
|
||||
|
||||
read_settings();
|
||||
|
||||
nickmatch = nickmatch_init(hilight_nick_cache);
|
||||
|
@ -160,6 +160,7 @@ static void print_line(TEXT_DEST_REC *dest, const char *text)
|
||||
/* send both the formatted + stripped (for logging etc.) */
|
||||
stripped = strip_codes(str);
|
||||
signal_emit_id(signal_print_text, 3, dest, str, stripped);
|
||||
g_free_and_null(dest->hilight_color);
|
||||
|
||||
g_free(str);
|
||||
g_free(stripped);
|
||||
@ -388,11 +389,6 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
|
||||
signal_emit_id(signal_gui_print_text_finished, 1, dest->window);
|
||||
}
|
||||
|
||||
static void sig_print_text_free(TEXT_DEST_REC *dest, const char *text)
|
||||
{
|
||||
g_free_and_null(dest->hilight_color);
|
||||
}
|
||||
|
||||
void printtext_multiline(void *server, const char *target, int level,
|
||||
const char *format, const char *text)
|
||||
{
|
||||
@ -439,7 +435,6 @@ void printtext_init(void)
|
||||
|
||||
read_settings();
|
||||
signal_add("print text", (SIGNAL_FUNC) sig_print_text);
|
||||
signal_add_last("print text", (SIGNAL_FUNC) sig_print_text_free);
|
||||
signal_add("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
|
||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
}
|
||||
@ -447,7 +442,6 @@ void printtext_init(void)
|
||||
void printtext_deinit(void)
|
||||
{
|
||||
signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
|
||||
signal_remove("print text", (SIGNAL_FUNC) sig_print_text_free);
|
||||
signal_remove("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
|
||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user