From cac0b722cd9e2d3eb1fb1f98306b1ca396c82023 Mon Sep 17 00:00:00 2001 From: William Minchin Date: Fri, 7 Feb 2014 08:21:28 -0700 Subject: [PATCH 1/2] Don't replace all double spaces want to maintain the ability to format with the use of just text. --- jrnl/Entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 142286ed..afef245b 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -46,7 +46,7 @@ class Entry: self.journal.config['linewrap'], initial_indent="| ", subsequent_indent="| ", - drop_whitespace=False).replace(' ', ' ') + drop_whitespace=False) for line in self.body.strip().splitlines() ]) else: From 24a5712c4d38c70eae305bb3e1c4d6652cc52ff2 Mon Sep 17 00:00:00 2001 From: William Minchin Date: Fri, 7 Feb 2014 08:24:30 -0700 Subject: [PATCH 2/2] 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. --- jrnl/Entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index afef245b..d4d3bb6d 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -42,7 +42,7 @@ class Entry: if not short and self.journal.config['linewrap']: title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap']) body = "\n".join([ - textwrap.fill(line+" ", + textwrap.fill((line + " ") if (len(line) == 0) else line, self.journal.config['linewrap'], initial_indent="| ", subsequent_indent="| ",