Fix key bindings in patch when changing the old or new version

We need to reset the current row when rendering the table again,
otherwise we might be off the table and not know it if there are
a lower number of lines in the new display.

Also, don't call display() again to change the view, only once
is sufficient.

Bug: GERRIT-188
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/src/main/java/com/google/gerrit/client/patches/PatchScreen.java b/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
index 9a317b0..a2c6a67 100644
--- a/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
+++ b/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
@@ -205,7 +205,9 @@
       script = null;
       comments = null;
 
-      display();
+      if (!isCurrentView()) {
+        display();
+      }
     }
   }
 
diff --git a/src/main/java/com/google/gerrit/client/ui/NavigationTable.java b/src/main/java/com/google/gerrit/client/ui/NavigationTable.java
index c9da9bf..7e799b4 100644
--- a/src/main/java/com/google/gerrit/client/ui/NavigationTable.java
+++ b/src/main/java/com/google/gerrit/client/ui/NavigationTable.java
@@ -28,6 +28,7 @@
 import com.google.gwtexpui.globalkey.client.GlobalKey;
 import com.google.gwtexpui.globalkey.client.KeyCommand;
 import com.google.gwtexpui.globalkey.client.KeyCommandSet;
+import com.google.gwtexpui.safehtml.client.SafeHtml;
 
 import java.util.LinkedHashMap;
 import java.util.Map.Entry;
@@ -196,6 +197,12 @@
     return -1;
   }
 
+  @Override
+  protected void resetHtml(SafeHtml body) {
+    currentRow = -1;
+    super.resetHtml(body);
+  }
+
   public void finishDisplay() {
     if (saveId != null) {
       movePointerTo(savedPositions.get(saveId));