asciidoctor-intellij-plugin icon indicating copy to clipboard operation
asciidoctor-intellij-plugin copied to clipboard

editor and preview out of sync when two soft line breaks are followed by includes

Open pstueck opened this issue 8 months ago • 7 comments

1624.zip

Observation vs. expected behaviour

Editor and preview are out of sync when navigating through the source of mini.adoc. Possibly related to the inclusion of tagged files, yet even without tags, the preview “goes mayhem” with included files.

I would expect the preview to jump to the first line of an included file, when the cursor reaches the actual include:: directive (or at least in closest vicinity-st). Not just “somewhere” (micro jumps not taken into account).

Steps to reproduce

I added a—not sooo—minimal example. Please reduce the preview window so that the jumps do happen.

When I navigate with the cursor through mini.adoc, the “jump lines” are 5 and 6 (which is waaayyy to early, IMHO).

  • 5 to 6 – preview jumps to the end of the rendered HTML
  • 6 to 5 – preview jumps to back to the text in the editor (about 2.5 lines before the actual text)

I was able to (slightly) workaround that by adding {empty} after each include. This does not completely fix the issue, yet provides a little bit better navigation. And now the “jump lines” differ on direction. Going down, it’s …

  • 5-to-6 (“Nam 1” at bottom of preview) … uhm … we are still way off from even the first include :rofl:
  • 10-to-11 (“Consetetur 2” near bottom of preview)
  • 13-to-14 (end-of-preview)

Going up, it’s (to give it credit, the jumps seem sensible, as they more or less go “to the other extreme”) ...

  • 14-to-13 (“Consetetur 2”)
  • 11-to-10 (“Nam 1”)
  • 6-to-5 (actual editor position)

And even when you remove the soft line breaks ( +), the main jump starts with line 5. The preview syncer seems to think that line 5 is the very last line before the first included file.

Environment

Plugin Version: 0.41.14

IntelliJ Details: IntelliJ IDEA 2024.1.2 (Ultimate Edition) Build #IU-241.17011.79, built on May 22, 2024 Licensed to *******

Runtime version: 17.0.11+1-b1207.24 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 6.2.0-36-generic GC: G1 Young Generation, G1 Old Generation Memory: 3966M Cores: 12 Registry: ide.experimental.ui=true Non-Bundled Plugins: com.jetbrains.space (241.17011.48) digital.pedda.loremIpsum (1.1) org.jetbrains.plugins.ruby (241.17011.79) org.asciidoctor.intellij.asciidoc (0.41.14) com.intellij.ml.llm (241.17011.2) com.mallowigi.colorHighlighter (18.0.0) com.firsttimeinforever.intellij.pdf.viewer.intellij-pdf-viewer (0.15.0) Kotlin: 241.17011.79-IJ Current Desktop: ubuntu:GNOME

pstueck avatar May 24 '24 16:05 pstueck