Merge pull request #590 from LemonBoy/hi-minor

Minor cleanup in the highlighting signal.
This commit is contained in:
ailin-nemui 2017-01-31 14:18:48 +01:00 committed by GitHub
commit 1ee25d2286

View File

@ -399,21 +399,16 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
char *middle;
int pos, color_pos, color_len;
tmp = g_string_new(NULL);
/* start of the line */
pos = strip_real_length(text, hilight_start, NULL, NULL);
g_string_append(tmp, text);
g_string_truncate(tmp, pos);
tmp = g_string_new_len(text, pos);
/* color */
g_string_append(tmp, color);
/* middle of the line, stripped */
middle = strip_codes(text + pos);
pos = tmp->len;
g_string_append(tmp, middle);
g_string_truncate(tmp, pos+hilight_len);
g_string_append_len(tmp, middle, hilight_len);
g_free(middle);
/* end of the line */