Closed lostways closed 3 years ago
@lostways while you're here, could you also check other instances of .split('\n')
, to see if they cause issues for you too? For example these two places:
I used the regex \r?\n
to match newlines. This will match \r\n
and \n
.
https://stackoverflow.com/questions/1331815/regular-expression-to-match-cross-platform-newline-characters https://stackoverflow.com/questions/5583579/question-marks-in-regular-expressions
You probably don't need to worry about the other chars and I hesitate to add them to the regex without being able to reliable test how they are handled. I can use that pattern in the SO if you prefer though.
I also created a utility method get_note_lines
to handle splitting the note content up.
Things to test (I tested all of these):
Thanks @lostways ! Looks good to me. I left one request to fix, but otherwise happy to merge once that is addressed and commits are tidied. :)
Awesome! Really enjoying the app and glad I can help improve it :-)
I noticed that if you create notes using the Windows SImplenote app, newlines are encoded with \r\n and not \n. This causes the note titles to end in "?" and all newlines to also show a "?" in the note view.
I fixed this by using str.splitlines() instead of str.split('\n') for the note view. I also modified the regex used to determine the title of the note. It now matches all non white spaces characters that are not \r or \n.
Windows Note:
Before Fix:
After Fix: