mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Display message when no edits take place (#1510)
This commit is contained in:
parent
28051046d5
commit
ed4f8eacea
3 changed files with 7 additions and 2 deletions
|
@ -46,7 +46,7 @@ def get_text_from_editor(config, template=""):
|
|||
os.remove(tmpfile)
|
||||
|
||||
if not raw:
|
||||
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.ERROR))
|
||||
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
|
||||
|
||||
return raw
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ def write_mode(args, config, journal, **kwargs):
|
|||
|
||||
if not raw or raw.isspace():
|
||||
logging.error("Write mode: couldn't get raw text or entry was empty")
|
||||
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.ERROR))
|
||||
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
|
||||
|
||||
logging.debug(
|
||||
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
|
||||
|
@ -342,6 +342,9 @@ def _print_edited_summary(journal, old_stats, **kwargs):
|
|||
)
|
||||
msgs.append(Message(my_msg, MsgStyle.NORMAL, {"num": stats["modified"]}))
|
||||
|
||||
if not msgs:
|
||||
msgs.append(Message(MsgText.NoEditsReceived, MsgStyle.NORMAL))
|
||||
|
||||
print_msgs(msgs)
|
||||
|
||||
|
||||
|
|
|
@ -149,6 +149,8 @@ class MsgText(Enum):
|
|||
https://jrnl.sh/en/stable/external-editors/
|
||||
"""
|
||||
|
||||
NoEditsReceived = "No edits to save, because nothing was changed"
|
||||
|
||||
NoTextReceived = """
|
||||
No entry to save, because no text was received
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue