MeanderingProgrammer / markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
504 stars 20 forks source link

Markdown Files Not Rendered Correctly on Horizontal Scroll #23

Closed dvnatanael closed 2 months ago

dvnatanael commented 2 months ago

It seems that scrolling horizontally breaks the plugin.

Steps to Reproduce

  1. Open demo/sample.md in nvim
  2. :set nowrap
  3. Go to a line that contains text (e.g. line 9)
  4. Press zL in normal mode

image

edit: wrong image

MeanderingProgrammer commented 2 months ago

I'm honestly not too sure if I want to do anything about this, mostly because long lines in Markdown seem incorrect in general.

The solution would be really expensive in that the auto-command would now need to listen to all cursor movements and re-render the marks with any horizontal offset applied.

If that's what the solution ends up being, and I personally cannot think of a way around it, I would rather leave it as a known limitation of this plugin. Especially when another solution is to have the user enable line wrapping on markdown files.

What do you think?

MeanderingProgrammer commented 2 months ago

Pushed a change to eventually disable rendering once the user has scrolled horizontally: https://github.com/MeanderingProgrammer/markdown.nvim/commit/966472e123195cb195e7af49d7db248ce104bee8

I did not want to add an auto-command on all scroll events, since there are just so many of them, so have left that out for the time being.

If there is a better approach to this definitely let me know!

dvnatanael commented 1 month ago

Hi, thanks for looking into this. I think that leaving this as a known limitation is perfectly fine, especially since the solution seems to be really expensive.

I'll be sure to let you know if I manage to think of a better approach.