summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2016-12-18 15:46:48 +0100
committerLemonBoy <thatlemon@gmail.com>2016-12-18 15:46:48 +0100
commita39e210ea8e0b0cdccb37eae212d1ade8c036ae2 (patch)
tree908c0b2f9e7b6f776a76ec29076deae300c78f55 /src/fe-common
parent618c8bd10e45b3132d356e2f6bec290a63b8a9fa (diff)
downloadirssi-a39e210ea8e0b0cdccb37eae212d1ade8c036ae2.zip
Minor cleanup in the highlighting signal.
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/hilight-text.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c
index 4691a708..46b416e6 100644
--- a/src/fe-common/core/hilight-text.c
+++ b/src/fe-common/core/hilight-text.c
@@ -379,34 +379,29 @@ 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);
+ middle = strip_codes(text + pos);
+ g_string_append_len(tmp, middle, hilight_len);
g_free(middle);
/* end of the line */
pos = strip_real_length(text, hilight_end,
&color_pos, &color_len);
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 {
/* no colors in line, change back to default */
g_string_append_c(tmp, 4);
g_string_append_c(tmp, FORMAT_STYLE_DEFAULTS);
}
- g_string_append(tmp, text+pos);
+ g_string_append(tmp, text + pos);
newstr = tmp->str;
g_string_free(tmp, FALSE);