case fold_token:
/* Here, we have token start at 'c' and token end at 'p' */
if (fold_type == fold_after) {
+ guint nspaces = 0;
+ const gchar *last;
if (p > c) {
g_string_append_len (res, c, p - c);
+
+ /*
+ * Check any spaces that are appended to the result
+ * before folding
+ */
+ last = &res->str[res->len - 1];
+
+ while (g_ascii_isspace (*last)) {
+ last --;
+ nspaces ++;
+ res->len --;
+ }
}
switch (how) {
p ++;
}
+ /* Move leftover spaces */
+ while (nspaces) {
+ g_string_append_c (res, ' ');
+ nspaces --;
+ }
+
cur_len = 0;
}
else {