Update diff line hash via Gerrit.Nav
Formerly, the gr-diff-view generated and updated the URL hash that
indicates the location of the diff cursor, regardless of the hash
generation scheme implemented in _generateUrl. With this change, the
diff view uses the _generateUrl for the cursor-location-specific URL.
Change-Id: Ia70a298f114c9eae9cdc5b0a8f73d7ecab55896e
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
index fbd5b1b..409fd09 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
@@ -727,7 +727,13 @@
_onLineSelected(e, detail) {
this.$.cursor.moveToLineNumber(detail.number, detail.side);
- history.replaceState(null, '', '#' + this.$.cursor.getAddress());
+ if (!this._change) { return; }
+ const cursorAddress = this.$.cursor.getAddress();
+ const url = Gerrit.Nav.getUrlForDiffById(this._changeNum,
+ this._change.project, this._path, this._patchRange.patchNum,
+ this._patchRange.basePatchNum, cursorAddress.number,
+ cursorAddress.leftSide);
+ history.replaceState(null, '', url);
},
_computeDownloadLink(changeNum, patchRange, path) {