ical.c: Remove newlines from item summaries

Newline characters are not allowed in calcurse item descriptions.
Replace any newlines in iCal summary lines with spaces.

Fixes GitHub issue #6.

Reported-by: Jonathan McCrohan <jmccrohan@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-07-08 13:12:43 +02:00
parent 82aa3e3f43
commit 936d5f139f

View File

@ -843,13 +843,19 @@ static char *ical_read_summary(char *line)
{
char *p, *summary;
if ((p = strchr(line, ':')) != NULL) {
p++;
summary = ical_unformat_line(p);
return summary;
} else {
p = strchr(line, ':');
if (!p)
return NULL;
}
summary = ical_unformat_line(p + 1);
if (!summary)
return NULL;
/* Event summaries must not contain newlines. */
for (p = strchr(summary, '\n'); p; p = strchr(p, '\n'))
*p = ' ';
return summary;
}
static void