Conversation
|
Good catch - fixed in 57b1bc2. Replacement blocks now merge whitespace-only pairs independently instead of all-or-nothing, so an import edit in the same block no longer stops a formatting-only pair from merging (the import pair itself stays hidden behind the marker). Numbering is untouched - entries keep their parsed numbers either way. Verified with a node harness: the mixed block renders one context row plus markers, no add/del rows. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 57b1bc2. Configure here.
| } | ||
| } | ||
| for (var ax = 0; ax < ar.length; ax++) { | ||
| if (!mergeFlags[ax]) merged.push(ar[ax]); |
There was a problem hiding this comment.
Partial merge splits paired lines
Medium Severity · Logic Bug
When a replacement block mixes whitespace-only pairs with real edits, leftover add rows are appended after later merged ctx lines. That separates a deletion from its matching addition and emits new-side line numbers out of order.
Reviewed by Cursor Bugbot for commit 57b1bc2. Configure here.


Fixes #472.
Two defects, one root pattern (mutating the diff before numbering it):
Verified with a node harness against the issue's two reproductions: old code numbers const x as 1 and collapses the string change; fixed code numbers it 3/3 with a 3-import marker row, keeps the string change as del+add, still collapses pure-whitespace diffs, and renders everything numbered correctly with showImports.
Note
Low Risk
Client-side diff rendering only; behavior is more accurate with backward-compatible
renderDiffsignature.Overview
Fixes incorrect diff display in the PR review canvas by numbering and parsing the full raw patch before any filtering, instead of dropping import lines up front (which skewed line numbers and hid import edits).
Import handling moves to render time: hidden imports collapse into a visible "N import lines hidden" row, with optional
renderDiff(..., { showImports: true })to show them normally.Whitespace-only merging is tightened:
isWhitespaceOnlynow normalizes whitespace runs rather than removing all spaces, so real content changes like"a b"→"ab"stay as del/add instead of folding into context. Whitespace merging runs in a second pass and can merge line-by-line within mixed del/add blocks (e.g. alongside import changes).Reviewed by Cursor Bugbot for commit 57b1bc2. Bugbot is set up for automated code reviews on this repo. Configure here.