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>
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 f26d775..b3bf55b 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 @@
   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 @@
 
   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 6cadf1f..aace582 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 @@
       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 86b2580..9911fa9 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 @@
       }
     }
     resetHtml(nc);
+    onlyOneHunk = script.getEdits().size() == 1;
 
     int row = script.getPatchHeader().size();
     final CellFormatter fmt = table.getCellFormatter();