forked from PsychoticNinja/irssi
Merge pull request #590 from LemonBoy/hi-minor
Minor cleanup in the highlighting signal.
This commit is contained in:
commit
1ee25d2286
@ -399,34 +399,29 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
|||||||
char *middle;
|
char *middle;
|
||||||
int pos, color_pos, color_len;
|
int pos, color_pos, color_len;
|
||||||
|
|
||||||
tmp = g_string_new(NULL);
|
|
||||||
|
|
||||||
/* start of the line */
|
/* start of the line */
|
||||||
pos = strip_real_length(text, hilight_start, NULL, NULL);
|
pos = strip_real_length(text, hilight_start, NULL, NULL);
|
||||||
g_string_append(tmp, text);
|
tmp = g_string_new_len(text, pos);
|
||||||
g_string_truncate(tmp, pos);
|
|
||||||
|
|
||||||
/* color */
|
/* color */
|
||||||
g_string_append(tmp, color);
|
g_string_append(tmp, color);
|
||||||
|
|
||||||
/* middle of the line, stripped */
|
/* middle of the line, stripped */
|
||||||
middle = strip_codes(text+pos);
|
middle = strip_codes(text + pos);
|
||||||
pos = tmp->len;
|
g_string_append_len(tmp, middle, hilight_len);
|
||||||
g_string_append(tmp, middle);
|
|
||||||
g_string_truncate(tmp, pos+hilight_len);
|
|
||||||
g_free(middle);
|
g_free(middle);
|
||||||
|
|
||||||
/* end of the line */
|
/* end of the line */
|
||||||
pos = strip_real_length(text, hilight_end,
|
pos = strip_real_length(text, hilight_end,
|
||||||
&color_pos, &color_len);
|
&color_pos, &color_len);
|
||||||
if (color_pos > 0)
|
if (color_pos > 0)
|
||||||
g_string_append_len(tmp, text+color_pos, color_len);
|
g_string_append_len(tmp, text + color_pos, color_len);
|
||||||
else {
|
else {
|
||||||
/* no colors in line, change back to default */
|
/* no colors in line, change back to default */
|
||||||
g_string_append_c(tmp, 4);
|
g_string_append_c(tmp, 4);
|
||||||
g_string_append_c(tmp, FORMAT_STYLE_DEFAULTS);
|
g_string_append_c(tmp, FORMAT_STYLE_DEFAULTS);
|
||||||
}
|
}
|
||||||
g_string_append(tmp, text+pos);
|
g_string_append(tmp, text + pos);
|
||||||
|
|
||||||
newstr = tmp->str;
|
newstr = tmp->str;
|
||||||
g_string_free(tmp, FALSE);
|
g_string_free(tmp, FALSE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user