jrnl-org / jrnl

Collect your thoughts and notes without leaving the command line.
https://jrnl.sh
GNU General Public License v3.0
6.45k stars 522 forks source link

Escaped "reserved characters" - entered in text editor are replaced #1547

Open clach04 opened 2 years ago

clach04 commented 2 years ago

Bug Report

Environment

Current Behavior

Escaped "reserved characters" are getting replaced. See steps

I spotted this when copy/pasting some source code into my journal entry.

Expected Behavior

The NOTE section in https://github.com/jrnl-org/jrnl/blob/develop/docs/usage.md#composing-entries strongly implies using a text editor will avoid problems (but it's not 100% clear what the behavior is supposed to be.

IMHO ;-) preserving the text as entered (other than macro replacement for yesterday:, etc.) seems reasonable.

Repro Steps

  1. starting jrnl with no parameters to use my configured text editor and then entering:

    backslash-n \nis replaced with a newline
    backslash-n \tmight end up being a tab
  2. saving results in the text as entered being removed.

Other Information

No runtime errors, a behavior/behaviour issue

micahellison commented 2 years ago

Thanks @clach04 for filing this. It's definitely a bug!

Looks like the culprit is in Entry.py _parse_text and only with \n.

A resolution to this:

pjz commented 2 years ago

I think the issue is https://github.com/jrnl-org/jrnl/blob/develop/jrnl/Journal.py#L313 ; why is that being done?

micahellison commented 2 years ago

I think the issue is https://github.com/jrnl-org/jrnl/blob/develop/jrnl/Journal.py#L313 ; why is that being done?

You're right, though I'm not sure why it's there. Still, it's not documented and it's not expected, so I think it's worth changing.