Fix syntax-highlighting.

In Change 338379 the logic was changed to cause gr-diff to rerender
because it was assumed that this was necessary to fix commenting issues
on re-entry of the same file. While this did fix that issue, it
introduced a different bug that would turn off syntax highlighting, as
that happens in GrDifFHost and not in GrDiff.

With this fix, and thanks to no longer reusing cursors from Change
338379, both bugs are fixed and we keep the performance benefits of not
reloading.

Google-Bug-Id: b/235350182
Release-Notes: skip
Change-Id: I1a59d461eef419dfa3fa0608b27d67705e5a0a80
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
index c18efbe..1c64a7e 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
@@ -1138,6 +1138,10 @@
       // changeNum has not changed, so check if there are changes in patchRange
       // path. If no changes then we can simply render the view as is.
       this.reporting.reportInteraction('diff-view-re-rendered');
+      // Make sure to re-initialize the cursor because this is typically
+      // done on the 'render' event which doesn't fire in this path as
+      // rerendering is avoided.
+      this.cursor?.reInitCursor();
       return;
     }
 
diff --git a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts
index 9bb4b3a..34c2a33 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts
@@ -312,13 +312,6 @@
     super.connectedCallback();
     this._observeNodes();
     this.isAttached = true;
-    if (this.diff !== undefined) {
-      // This is not ideal as we lose the caching effect when going between
-      // change-view and the first diff-view.
-      // However, this is currently broken because we never fire the event
-      // 'render' when not actually re-rendering.
-      this._debounceRenderDiffTable();
-    }
   }
 
   override disconnectedCallback() {