jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
892 stars 163 forks source link

[Suggestion] Consider using a "responsive" display property for the separator in markdown-view-mode #753

Closed casouri closed 1 year ago

casouri commented 1 year ago

Since eglot uses markdown-view-mode for rendering the documentation, the separator is often too long when the documentation put into a small child frame for display:

Expected Behavior

It would be nicer if the separator is "responsive": it changes width according to the viewing window's width:

Screenshot 2023-03-04 at 11 29 20 PM

Idea

We can render the separator with the display property set to (space :width text), which displays a space as long as the text portion of the window, plus a face property set to (: strike-through t), which renders a horizontal line across the whole white space.

For the code I used for the screenshot in the Expected behavior section, see https://github.com/casouri/eldoc-box/issues/60

Thanks!

syohex commented 1 year ago

Thank you for reporting issue. I think this is a bug in CJK language configuration. Please see #755.

And thanks for suggestion however your idea is not work if terminal or fonts don't support strike-throught characters.

casouri commented 1 year ago

The documentation text is rendered by eglot prior to be displayed by eldoc-box in a smaller window, so if the separator doesn't adjust to window width automatically, it'll always stick out.

Maybe you can implement the rendering differently based on terminal vs GUI? Strike-though don't need font support. That's your call, and feel free to close this :-)

nemethf commented 1 year ago

Wouldn't it make sense to adapt make-separator-line of Emacs 29? That creates a horizontal line from edge to edge, and works even if the window-width changes later.

joaotavora commented 1 year ago

And thanks for suggestion however your idea is not work if terminal or fonts don't support strike-throught characters.

Hey, then don't use strike-through when it's not support. Just add something that is supported and be sure to put (:extend t) in the face. It's the only place in markdown.el where window-body-width is used, and it's a shame. As soon as you resize the window or take the text for some other presentation, it breaks.

Using display with make-string for this is not the correct way to do separator lines in Emacs. Just looks at all the places where :extend t is used.

syohex commented 1 year ago

I have merged #757. Please check latest version