From cc7df68aea62e2e3a18c996fa56048f1e583faa5 Mon Sep 17 00:00:00 2001 From: Jamie Peabody Date: Tue, 24 Feb 2026 20:19:07 +0000 Subject: [PATCH] fix(#228): Clicking on edit marker in gutter now accounts for top position of editor. --- src/diff-view.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/diff-view.js b/src/diff-view.js index 5465317..99faeb8 100644 --- a/src/diff-view.js +++ b/src/diff-view.js @@ -1190,7 +1190,9 @@ CodeMirrorDiffView.prototype._renderDiff = function(changes) { ex.lhs_scroller.scrollTo({ top: sto }); }; this._handleRhsMarginClick = function (ev) { - const y = ev.pageY - ex.rhs_xyoffset.top - (rto / 2); + // `top` accounts for the editor starting at position other than 0 on page + const { top } = ev.currentTarget.offsetParent.getBoundingClientRect(); + const y = (ev.pageY - top) - ex.rhs_xyoffset.top - (rto / 2); const sto = Math.max(0, (y / mcanvas_rhs.height) * ex.rhs_scroller.scrollHeight); ex.rhs_scroller.scrollTo({ top: sto }); };