replace string "\n" with char '\n'

this way we don't need the extra check for the string "\n" in
do_word_wrap and rstrip strips newlines away.

fixes github issue #80
This commit is contained in:
Sascha Kruse 2012-12-21 16:04:48 +01:00
parent f054dab8be
commit f46f9bff17

View File

@ -533,11 +533,6 @@ int do_word_wrap(char *source, int max_width)
*eol = '\0'; *eol = '\0';
return 1 + do_word_wrap(eol + 1, max_width); return 1 + do_word_wrap(eol + 1, max_width);
} }
if (*eol == '\\' && *(eol + 1) == 'n') {
*eol = ' ';
*(eol + 1) = '\0';
return 1 + do_word_wrap(eol + 2, max_width);
}
if (word_wrap && max_width > 0) { if (word_wrap && max_width > 0) {
if (textnw(dc, source, (eol - source) + 1) >= max_width) { if (textnw(dc, source, (eol - source) + 1) >= max_width) {
@ -1070,6 +1065,10 @@ int init_notification(notification * n, int id)
} }
n->msg = fix_markup(n->msg); n->msg = fix_markup(n->msg);
while (strstr(n->msg, "\\n") != NULL)
n->msg = string_replace("\\n", "\n", n->msg);
n->msg = rstrip(n->msg); n->msg = rstrip(n->msg);