summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-05-16 16:07:16 -0700
committerShawn O. Pearce <sop@google.com>2009-05-16 16:08:26 -0700
commit8724604fa97e76a5ed61435476979cbf58da2a74 (patch)
tree1810154ff51af367451a4115103fd30c2ffd898d
parent87b41f8214a0172eb2ba99c3e615e491221d2379 (diff)
Make n/p only honor comments on file adds/deletes
If there is exactly one edit region for the file, such as what happens when the file is added to the project, make n/p only match on comments as these are much more interesting. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java3
-rw-r--r--src/main/java/com/google/gerrit/client/patches/SideBySideTable.java1
-rw-r--r--src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java1
3 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java b/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java
index f26d775dec..b3bf55bbd3 100644
--- a/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java
+++ b/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java
@@ -52,6 +52,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
protected Patch.Key patchKey;
protected PatchSet.Id idSideA;
protected PatchSet.Id idSideB;
+ protected boolean onlyOneHunk;
private final Timestamp aged =
new Timestamp(System.currentTimeMillis() - AGE);
@@ -146,7 +147,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
private boolean isChunk(final int row) {
final Object o = getRowItem(row);
- if (o instanceof PatchLine) {
+ if (!onlyOneHunk && o instanceof PatchLine) {
final PatchLine pl = (PatchLine) o;
switch (pl.getType()) {
case DELETE:
diff --git a/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java b/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java
index 6cadf1feb5..aace582d9c 100644
--- a/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java
+++ b/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java
@@ -121,6 +121,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
appendSkipLine(nc, b.size() - lastB);
}
resetHtml(nc);
+ onlyOneHunk = script.getEdits().size() == 1;
for (int row = 0; row < lines.size(); row++) {
setRowItem(row, lines.get(row));
diff --git a/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java b/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java
index 86b2580d08..9911fa9d18 100644
--- a/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java
+++ b/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java
@@ -119,6 +119,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
}
}
resetHtml(nc);
+ onlyOneHunk = script.getEdits().size() == 1;
int row = script.getPatchHeader().size();
final CellFormatter fmt = table.getCellFormatter();