mergely scroll diff change to middle

Skip to first unread message

harpal sing

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

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.


harpal sing

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,

On Jun 18, 2020, at 1:53 PM, Jamie Peabody <> 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
To view this discussion on the web, visit

Jamie Peabody

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
0 new messages