use of net.codemirror.lib.CodeMirror.LineHandle in project gerrit by GerritCodeReview.
the class SideBySide method updateActiveLine.
@Override
Runnable updateActiveLine(CodeMirror cm) {
CodeMirror other = otherCm(cm);
return () -> {
// The rendering of active lines has to be deferred. Reflow
// caused by adding and removing styles chokes Firefox when arrow
// key (or j/k) is held down. Performance on Chrome is fine
// without the deferral.
//
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
operation(() -> {
LineHandle handle = cm.getLineHandleVisualStart(cm.getCursor("end").line());
if (!cm.extras().activeLine(handle)) {
return;
}
LineOnOtherInfo info = lineOnOther(cm.side(), cm.getLineNumber(handle));
if (info.isAligned()) {
other.extras().activeLine(other.getLineHandle(info.getLine()));
} else {
other.extras().clearActiveLine();
}
});
}
});
};
}
Aggregations