Smooth scrolling to a distant diff

Issue #161 resolved
Serhan Apaydın
created an issue

Prelude:

Hi all,

I'm trying to implement a smooth-scrolling animation that's supposed to happen when I jump from a diff to another one that's not visible in the editor at that moment (a distant diff, I mean).

This is what I came up with:

smooth-scroll.gif

Using the following changes:

https://github.com/monoblaine/WinMerge2011/commit/c9b0cc54722b92f5ee0e934b1d95200180b1b142

The obvious problem here is that the two panes do not scroll simultaneously because async programming is one of the many things I suck at C++.

https://bitbucket.org/jtuc/winmerge2011/src/1d1d31454a4fe703dd2fb9a8b30793a29670e8a7/Src/MergeEditView.cpp#lines-610

Here I've tried calling pCurrentView->ScrollToSubLine(nLine); and pOtherView->ScrollToSubLine(nLine); in separate threads to make them run simaltaneously, which kinda worked, but led to problems related to incorrect positioning of the caret so I gave up.

Any guidance, advice, etc. would be greatly appreciated.

Comments (3)

  1. jtuc repo owner

    Thanks for sharing your inspiring work. Changeset c30165eb8725 takes a somewhat same but different approach. It doesn't scroll the whole distance, but just a few lines from the starting point, to create a fancy looking effect without slowing down the whole thing too much. It also addresses the simultaneousness issue.

  2. Log in to comment