asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

"recursion" issues between "scroll editor with preview" and "scroll preview with editor"

Open aisbergde opened this issue 3 years ago • 4 comments
trafficstars

By default both options are enabled:

  • "scroll editor with preview"
  • "scroll preview with editor"

Lately, when entering text in the editor, the content jumps back and forth very often. Or better said, the window scrolls unexpectedly, and often you can't see where the cursor is anymore.

This only happens in AsciiDoc documents, so it probably has something to do with the AsciiDoc preview. Maybe only if there are includes. Maybe only if you are writing and the current document has not been saved yet.

I have now once turned off the "scroll editor with preview" option, and it seems that now these problems no longer occur. I'll have to keep monitoring this.

I suspect something like a recursion: editor => preview => editor.

Presumably this has worked quite well in the past, at least I haven't noticed any problems.

aisbergde avatar Sep 20 '22 11:09 aisbergde

Could you please share a short video?

ggrossetie avatar Sep 25 '22 09:09 ggrossetie

It works very well as long as there is no include or larger image. The problems seem to be related to those, especially when they are included in larger example blocks.

Once I get the effect back, I'll try to record it. However, I am currently working in a project where many resources are blocked. In particular, GitHub is blocked. It will be hard or impossible creating and uploading recordings from there.

I'll have to try to track that locally.

aisbergde avatar Sep 25 '22 13:09 aisbergde

https://user-images.githubusercontent.com/9020187/193660223-5eac2640-9a2c-428b-8c45-61ee48beb98c.mp4

Here is a video, you see, sometimes it jumps up. Sometimes only for a short time (a part of a second), and then the cursor jumps back. But sometimes it will stay in the place, where it jumped into.

I have some images in the page, maybe this is related.

And it looks like this happens more often, when I am writing near to the lower border of the window.

aisbergde avatar Oct 03 '22 19:10 aisbergde

I have some images in the page, maybe this is related.

That might be the reason. When images load, the scroll position will be updated (since images take vertical space). I think we should wait for all ressources to be loaded before doing scroll synchronisation.

It would be interesting to add debug code in https://github.com/asciidoctor/asciidoctor-vscode/blob/master/preview-src/index.ts

ggrossetie avatar Oct 04 '22 09:10 ggrossetie