Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carriage returns appear to be ignored #4

Open
maikthulhu opened this issue Apr 25, 2019 · 3 comments
Open

Carriage returns appear to be ignored #4

maikthulhu opened this issue Apr 25, 2019 · 3 comments

Comments

@maikthulhu
Copy link

Hi @Savjee! I am loving this app, but I have found that if I copy from Vim on my Mac or from a Linux VM and then paste into OneNote, it will very often ignore blank lines which causes me to go insert them manually. Sometimes (but not always) the blank line appears to be replaced with a leading space at the beginning of the next line.

Have you experienced this or am I doing something wrong?

@Savjee
Copy link
Owner

Savjee commented Apr 30, 2019

Hmm that's a weird issue. OneHighlighter doesn't do anything special when you paste in text. It's basically just a HTML textarea element. Maybe it's because Vim doesn't use CRLF but LF?

@maikthulhu
Copy link
Author

That doesn't appear to be the case. I converted a file with unix line endings to DOS line endings (using unix2dos) and tried copying from directly within vim, choosing the Python highlighting, and pasting into OneNote. I did this on both the unix and DOS versions of the file but the output was still the same as described in the original issue.

... And as I was writing this I copied a section of python, chose OneHighlighter from the menu bar and left it on auto-detect. I don't know what it's auto-detecting as, but after I pasted it with that highlighting, the newlines were preserved as expected. This appears that it may just be a problem with the Python syntax highlighting, and indeed that is what I use most often.

@maikthulhu
Copy link
Author

I just came across this issue with the C syntax highlighting as well. The native file I created (in a VM using vim) had CRLF line-endings. When I copied that from the VM, used OneHighlighter, then pasted it into OneNote, it was one huge glob of text with no line-endings. I then used dos2unix on the file (within the VM), copied the contents again, used OneHighlighter, then pasted into OneNote, and I get similar paste behavior as what I described with Python above. If I use unix2dos to convert LF to CRLF again, then go through the motions, the paste ends up being a glob of text again.

Curious behavior. If I get the time I'd love to dig into this and do a PR. Just documenting what I can, for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants