Merge "Use Shift-Left and Shift-Right to flip side of focus"
This commit is contained in:
@@ -331,7 +331,9 @@ public class SideBySide2 extends Screen {
|
||||
}
|
||||
})
|
||||
.on("Alt-N", diffChunkNav(cm, false))
|
||||
.on("Alt-P", diffChunkNav(cm, true)));
|
||||
.on("Alt-P", diffChunkNav(cm, true))
|
||||
.on("Shift-Left", flipCursorSide(cm, true))
|
||||
.on("Shift-Right", flipCursorSide(cm, false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1012,7 +1014,6 @@ public class SideBySide2 extends Screen {
|
||||
if (!(cm.hasActiveLine() &&
|
||||
cm.getLineNumber(cm.getActiveLine()) == line)) {
|
||||
cm.setCursor(LineCharacter.create(line));
|
||||
updateActiveLine(cm).run();
|
||||
}
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
@Override
|
||||
@@ -1102,6 +1103,20 @@ public class SideBySide2 extends Screen {
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable flipCursorSide(final CodeMirror cm, final boolean toLeft) {
|
||||
return new Runnable() {
|
||||
public void run() {
|
||||
if (cm.hasActiveLine() && (toLeft && cm == cmB || !toLeft && cm == cmA)) {
|
||||
CodeMirror other = otherCm(cm);
|
||||
other.setCursor(LineCharacter.create(
|
||||
mapper.lineOnOther(
|
||||
getSideFromCm(cm), cm.getLineNumber(cm.getActiveLine())).getLine()));
|
||||
other.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable diffChunkNav(final CodeMirror cm, final boolean prev) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user