awth13 / org-appear

Toggle visibility of hidden Org mode element parts upon entering and leaving an element
MIT License
369 stars 19 forks source link

org-appear triggers incorrect linebreaks with visual-line #6

Closed ahyatt closed 3 years ago

ahyatt commented 3 years ago

Especially when expanding a link, the link could force the cursor to be temporarily over the threshold for when visual-line-mode would do a line wrap. When the user continues typing, the link is on the next line, which would be proper with the full link, but the link shrinks back down and the text doesn't re-flow with it.

For example, with visual-line-mode on, type:

abcdefghijklmnopqrstuvwxyz [[http://averyveryveryverylongdomainnametopadthingsout.org][test]]

When hitting space at the end, the link flows to the next line. When it shrinks down, it looks like:

abcdefghijklmnopqrstuvwxyz
_test_ extra text.

(with the test being the link). It should be:

abcdefghijklmnopqrstuvwxyz _test_ extra text.
awth13 commented 3 years ago

I can't seem to reproduce this, neither in a clean Emacs setup nor in my config. This also shouldn't happen, as org-appear doesn't modify anything in the buffer. Do you have the same issue if you disable org-appear and toggle the very long link using org-toggle-link-display?

ahyatt commented 3 years ago

It does in fact have the same issue with org-toggle-link-display, thank you for pointing that out. I investigated a bit more, and it turns out this is due to auto-fill-mode. It still seems like a bug, but perhaps a bug with org-mode, or maybe with auto-fill-mode. I'll close this out, thank you for looking at this!