mergely scroll diff change to middle

24 views
Skip to first unread message

harpal sing

unread,
Jun 18, 2020, 4:04:21 PM6/18/20
to Mergely
I want to scroll the diff change on the vertically center of the screen every time I click on the next diff. As scrollToDiff (next/prev) always end up scrolling the diff at end or on top of the window. Is there a way to handle the scenario

Jamie Peabody

unread,
Jun 18, 2020, 4:53:39 PM6/18/20
to Mergely
Hi Harpal,

I agree with you - that could be better.  But I don't think it would be easy - Mergely is just using the CodeMirror scrollIntoView function.  It does not have an option to choose the position in the page that the line appears.

Jamie

harpal sing

unread,
Jun 18, 2020, 10:43:01 PM6/18/20
to Jamie Peabody, Mergely
Thank you Jamie for quick response. If Mergely is using CodeMirror scrollIntoView function then is there any option that I can manually perform  scrollIntoView or I can call any CodeMirror option to do that.

Thanks & Regards,
-Harpal

On Jun 18, 2020, at 1:53 PM, Jamie Peabody <jamie....@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "Mergely" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mergely+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mergely/e133bffa-4798-431d-ad1e-73dece3a98c1o%40googlegroups.com.

Jamie Peabody

unread,
Jun 19, 2020, 5:16:35 AM6/19/20
to harpal sing, Mergely
I think it would be difficult to get right.  The only thing that comes to mind is to figure out the extents of the window (e.g. that it can show 40 lines) and find the first/last line numbers of that extent and then calculate a different line to scroll into view such that the diff will render in the middle.  An extra complication is that line heights can vary when line wrapping is enabled.  So, as you can imagine, it's a good bit of work.

Reply all
Reply to author
Forward
0 new messages