SideBySide2: Add shift-m to mark reviewed and open next file

In the old UI "M" marked the reviewed flag (if not already set)
and moved to the next file in the change. Implement a similar
behavior in the new SideBySide2 UI.

Bind as "shift m" instead of "M" due to vim mode using lowercase
"m" as a mark character, which some users may actually use to make
bookmarks during a review.

Change-Id: I1e7780e6265fa3380aae09c034583dec7ec4830a
This commit is contained in:
Shawn Pearce
2013-12-30 16:30:20 -08:00
parent 132194e80a
commit 9dff161cf4
2 changed files with 20 additions and 0 deletions

View File

@@ -310,6 +310,18 @@ class Header extends Composite {
}
}
Runnable reviewedAndNext() {
return new Runnable() {
@Override
public void run() {
if (Gerrit.isSignedIn()) {
reviewed.setValue(true, true);
}
navigate(Direction.NEXT).run();
}
};
}
String getNextPath() {
return nextPath;
}

View File

@@ -306,6 +306,7 @@ public class SideBySide2 extends Screen {
.on("'c'", commentManager.insertNewDraft(cm))
.on("N", maybeNextVimSearch(cm))
.on("P", chunkManager.diffChunkNav(cm, Direction.PREV))
.on("Shift-M", header.reviewedAndNext())
.on("Shift-N", commentManager.commentNav(cm, Direction.NEXT))
.on("Shift-P", commentManager.commentNav(cm, Direction.PREV))
.on("Shift-O", commentManager.openCloseAll(cm))
@@ -423,6 +424,13 @@ public class SideBySide2 extends Screen {
header.toggleReviewed().run();
}
});
keysAction.add(new KeyCommand(
KeyCommand.M_SHIFT, 'm', PatchUtil.C.markAsReviewedAndGoToNext()) {
@Override
public void onKeyPress(KeyPressEvent event) {
header.reviewedAndNext().run();
}
});
keysAction.add(new KeyCommand(0, 'a', PatchUtil.C.openReply()) {
@Override
public void onKeyPress(KeyPressEvent event) {