SideBySide2: Synchronize horizontal scrolling
Disable CM3 line wrapping and rely on synchronized horizontal scrolling instead. This fixes alignment problems caused by long lines that exist only one of two sides. When line wrapping, the view did not pad the other side to account for the extra line height used by the wrapped line, skewing everything after it. Since horizontal scrolling is now functional change the widths of the views to be related to the width of the browser window. Keep a maximum width to prevent the a large gap between the sides on very wide monitors. Change-Id: I3a3b10fefdacd7246e4856365cb91d934f0346e2
This commit is contained in:
@@ -37,8 +37,7 @@ class ScrollSynchronizer {
|
||||
cmB.on("scroll", new ScrollCallback(cmB, cmA, DisplaySide.B));
|
||||
}
|
||||
|
||||
private void updateScreenHeader(CodeMirror cm) {
|
||||
ScrollInfo si = cm.getScrollInfo();
|
||||
private void updateScreenHeader(ScrollInfo si) {
|
||||
if (si.getTop() == 0 && !Gerrit.isHeaderVisible()) {
|
||||
Gerrit.setHeaderVisible(true);
|
||||
diffTable.updateFileCommentVisibility(false);
|
||||
@@ -77,8 +76,9 @@ class ScrollSynchronizer {
|
||||
fixup.scheduleRepeating(20);
|
||||
}
|
||||
if (active == this) {
|
||||
updateScreenHeader(src);
|
||||
dst.scrollToY(src.getScrollInfo().getTop());
|
||||
ScrollInfo si = src.getScrollInfo();
|
||||
updateScreenHeader(si);
|
||||
dst.scrollTo(si.getLeft(), si.getTop());
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user