Make 'c', 'r' in a patch view open a new comment editor

Like enter, these open a new comment editor for the current line.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-02-13 10:47:35 -08:00
parent b97bd5e42a
commit 443abc0574
2 changed files with 12 additions and 1 deletions

View File

@@ -107,6 +107,17 @@ public abstract class AbstractPatchContentTable extends FancyFlexTable<Object> {
case KeyboardListener.KEY_UP: case KeyboardListener.KEY_UP:
case KeyboardListener.KEY_DOWN: case KeyboardListener.KEY_DOWN:
return false; return false;
case 'c':
case 'r':
for (int row = getCurrentRow(); 0 <= row; row--) {
final Object item = getRowItem(row);
if (!(item instanceof CommentList) && item != null) {
onOpenItem(item);
break;
}
}
return true;
} }
} }
return super.onKeyPress(keyCode, modifiers); return super.onKeyPress(keyCode, modifiers);

View File

@@ -155,7 +155,7 @@ public abstract class FancyFlexTable<RowItem> extends Composite implements
} }
} }
private void onOpen() { protected void onOpen() {
if (0 <= currentRow && currentRow < table.getRowCount()) { if (0 <= currentRow && currentRow < table.getRowCount()) {
final RowItem item = getRowItem(currentRow); final RowItem item = getRowItem(currentRow);
if (item != null) { if (item != null) {