-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scroll to the first line when the preview hits top #475
Conversation
Arguably, we could scroll to top no matter what... I think this is the expected behavior anyway. Thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I think we have an off by one error. It is an improvement and I apologise for being a little niggardly...
I am not sure, I probably wouldn't put much effort into it. I don't think the preview and source should be "perfect" because the underlying alignment is not 1-to-1 (we have hidden things, comments, document attributes etc.). I am concerned about side effects and jumping back and forth for a single line change for large document headers. There is already a problem like this at the bottom of some documents which I've experienced where the preview and source pane flutter alarmingly whenever you scroll below a particular point. On small form factors or when the window isn't maximized this could be an issue, perhaps when you scroll after the title or after the document attributes or to the first We also have this problem for tables where which cross more than one screen because we can't allocate I guess the proof would be to implement it and see if it can be made suitably robust. |
69b8bbf
to
17163e3
Compare
That's true but when the scrollbar hits the top (or the bottom) it should also hits the top (or the bottom) of the preview/editor.
Here's the result: Not sure if it's possible but we could "smooth scroll" instead of "jumping". In my opinion, today it's even worse since you cannot have both scrollbars at the top (i.e., show the document title on both the preview and the editor):
As far as I know this improvement does not improve or worsen the situation regarding tables.
I did and I think it's better, now both sides will be synced when they reach the top. |
I agree, thanks for this! Let's do it. |
Since the document title does not have a
data-line
attribute when we scroll to the top on the preview it does not scroll to the document title (but to the first block).I didn't find a way to do the opposite (i.e., when we scroll to the top of the AsciiDoc document, scroll to the top of the preview). The reason is that we cannot tell what is on the first line. I guess we could read the first line and check if it's the document title but even then the document title could be hidden in the preview with
:showtitle!:
.So this pull request partially fixes #348