jittering mousewheel scrolling with merge addon align mode

The merge addon has a bug that when using the “align” connect, and when the text change has inserted lines on both editor. It can be easily reproduced by these steps:

  • open codemirror home page: http://codemirror.net/index.html
  • in the demo section, choose “merge/diff interface”.
  • in “merge view demo”, edit the left side to add a few garbage lines which are not in the right side, these new lines are better spreaded to different places in the editor, for example, add 3 new garbage lines at line 10, 4 new garbage lines at line 30, 5 new garbage lines at line 50. Also delete a few lines on the left side so that the left side has new insertion lines.
  • click to enable “align”. The issue happens also for not “align”, but more obvious for “align” mode.
  • now, in left or right editor, roll the mousewheel up and down then let it go, you’ll see the funny scrolling behavior: it might jitter constantly without scrolling, or scroll up a distance then reset and scroll up again and again.

Does patch https://github.com/codemirror/CodeMirror/commit/1bfa666170100a4b40c14766f11460838a9c3ad8 help? (Removing the padding, before re-adding it, caused the scroll position to jump up, since it made the document less tall)

Yes, I think it’s fixed by the patch! At least I can’t trigger the issue for that file any more.

Thank you, marijn!