From bfd1cf5eb8ea07adb48b09f4719477d328312824 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Fri, 3 Jul 2020 14:43:48 -0700 Subject: [PATCH] Fix small bug related to starring an entry with a date If a date was given with an entry, and the star was also was added, the star wouldn't be recognized if it was at the start of the title. Example that didn't work, but now works with this fix: jrnl "saturday: *Title words." This is to be consistent in starring functionality with and without a date in the entry. --- jrnl/Journal.py | 7 ++++++- jrnl/cli.py | 2 +- jrnl/{parsing.py => parse_args.py} | 0 3 files changed, 7 insertions(+), 2 deletions(-) rename jrnl/{parsing.py => parse_args.py} (100%) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 8968cb5f..a862d5e9 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -279,7 +279,12 @@ class Journal: if date: # Parsed successfully, strip that from the raw text starred = raw[:colon_pos].strip().endswith("*") raw = raw[colon_pos + 1 :].strip() - starred = starred or first_line.startswith("*") or first_line.endswith("*") + starred = ( + starred + or first_line.startswith("*") + or first_line.endswith("*") + or raw.startswith("*") + ) if not date: # Still nothing? Meh, just live in the moment. date = time.parse("now") entry = Entry.Entry(self, date, raw, starred=starred) diff --git a/jrnl/cli.py b/jrnl/cli.py index c70bfccb..5a1398ba 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -25,7 +25,7 @@ import platform import sys from . import install, plugins, util -from .parsing import parse_args +from .parse_args import parse_args from .Journal import PlainJournal, open_journal from .util import WARNING_COLOR, ERROR_COLOR, RESET_COLOR, UserAbort from .util import get_journal_name diff --git a/jrnl/parsing.py b/jrnl/parse_args.py similarity index 100% rename from jrnl/parsing.py rename to jrnl/parse_args.py