Fix linewrap

If a line was exactly the length of `linewrap`, the extra space was
causing the next line to be blank. But if the line is empty, we need the
space to maintain the `| ` sidebar.
This commit is contained in:
William Minchin 2014-02-07 08:24:30 -07:00
parent 8c461c7f9c
commit 545d2c296a

View file

@ -42,7 +42,7 @@ class Entry:
if not short and self.journal.config['linewrap']: if not short and self.journal.config['linewrap']:
title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap']) title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap'])
body = "\n".join([ body = "\n".join([
textwrap.fill(line+" ", textwrap.fill((line + " ") if (len(line) == 0) else line,
self.journal.config['linewrap'], self.journal.config['linewrap'],
initial_indent="| ", initial_indent="| ",
subsequent_indent="| ", subsequent_indent="| ",