use of net.codemirror.lib.CodeMirror in project gerrit by GerritCodeReview.
the class DiffScreen method onGutterClick.
private GutterClickHandler onGutterClick(final CodeMirror cm) {
return new GutterClickHandler() {
@Override
public void handle(CodeMirror instance, final int line, final String gutterClass, NativeEvent clickEvent) {
if (Element.as(clickEvent.getEventTarget()).hasClassName(getLineNumberClassName()) && clickEvent.getButton() == NativeEvent.BUTTON_LEFT && !clickEvent.getMetaKey() && !clickEvent.getAltKey() && !clickEvent.getCtrlKey() && !clickEvent.getShiftKey()) {
cm.setCursor(Pos.create(line));
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
getCommentManager().newDraftOnGutterClick(cm, gutterClass, line + 1);
}
});
}
}
};
}
use of net.codemirror.lib.CodeMirror in project gerrit by GerritCodeReview.
the class SideBySide method moveCursorToSide.
private Runnable moveCursorToSide(CodeMirror cmSrc, DisplaySide sideDst) {
CodeMirror cmDst = getCmFromSide(sideDst);
if (cmDst == cmSrc) {
return () -> {
};
}
DisplaySide sideSrc = cmSrc.side();
return () -> {
if (cmSrc.extras().hasActiveLine()) {
cmDst.setCursor(Pos.create(lineOnOther(sideSrc, cmSrc.getLineNumber(cmSrc.extras().activeLine())).getLine()));
}
cmDst.focus();
};
}
Aggregations