vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
425 stars 61 forks source link

Definition lists play poorly with soft-wrapping #394

Open ag-eitilt opened 3 weeks ago

ag-eitilt commented 3 weeks ago

I don't have a minimal reproducer since small documents are obviously not as affected, but I'm putting together a design requirements/algorithm sketch document that's grown to 60 KB with a lot of definition lists (used both for terms and for labeling branches), and there's a few lists in there that very noticeably chug -- there's one that's only five single-paragraph entries tall, where if I'm scrolling past with gk/gj NVim doesn't update at all for half a second until it catches back up with itself -- though oddly not every list is affected to the same degree.

As soon as I set g:pandoc#syntax#use_definition_lists=0 and reload, everything is immediately so much more snappy. I suspect this comes down to the same thing you mentioned in #257 of soft-wrap lines not being properly tested, compounded by definition lists being uncommon themselves and this file being larger than most; this is the first time I've had issues with the highlighting, so I think you've likely done a fair amount of optimization since that old issue was filed. A couple days ago I briefly tried hard-wrapping it all (hence the modeline) and I think I remember it being solved that way as well, but I ultimately decided I didn't like the formatting enough, and I can't remember now if it solved things as nicely as disabling that syntax option does.

I've uploaded the file in its current state to https://gist.github.com/ag-eitilt/5c94e24746afcb61c5965a2dfebc8b36#edit-target-ownership-checks if you want something to play with yourself, but you can ignore the content[^1]; the worst offender is the list in "Edit target ownership tests", around line 150.

[^1]: In fact, I encourage you to ignore it. Not only is the document fundamentally incomplete, I'm also in the middle of two or three rewrites at once so there's a mix of styles, language, some algorithm steps are duplicated, ...