moacirrf / netbeans-markdown

This plugin adds some additional features to Apache Netbeans Markdown Editor. Preview, Split Window, Suggestion, Export to DOCX, PDF and HTML
https://github.com/moacirrf/netbeans-markdown
GNU General Public License v3.0
16 stars 1 forks source link

Better way to synchronize the scroll of editor panel and preview panel #11

Closed moacirrf closed 1 year ago

Chris2011 commented 2 years ago

Hey, I found some little things and I dunno maybe this ticket here is one of my cases so I won't create a new one. So for this, can you please add more info to that, what you mean by that?

moacirrf commented 2 years ago

Hi

The problem is how to synchronize the both viewports?, find a way to keep the visible part in same position. image The above image works fine, because is the first line of file or when you are working with small md files. But look the next image: image What will happen if you scroll the left panel to red position? Little messy: image The desired result is: image

Clearly the synchronization must be based on content of the left JEditorPane and not just based on the viewport position.

Until now i cant fix this problem. I tried many ways, but a good way was: Get the text showing on left panel using viewToModel2D So i just search the text on right panel, and scroll to the position using modelToView and scrollRectToVisible

Works "well" but the result is not good enough, so i don't publish.

The file that i'm using to test teste.md

Thanks

Chris2011 commented 2 years ago

Ahh now I see it better. Thx :). I always compare the stuff with other editors or IDEs. I can see a difference when I open a large file which is scrollable, in NetBeans with your plugin and use split view or using VS Code. I can say that the scrollbar of the source pane is smaller than the scrollbar of the preview. If that makes sense somehow.