Repository navigation
skip unchanged padding in side-by-side git diffs - #19450
Conversation
RStudio E2E - all platforms1 test(s) failed
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
gtritchie
left a comment
There was a problem hiding this comment.
Approving. I didn't find any correctness issues in the planning and apply logic. Two small requests inline: the NEWS entry and a test assertion that can be skipped silently.
Optional, take or leave:
PaddingPlan.prototype.copyWidgetrepeats the padding-removal rules of$removeLineWidgets, whichdetach()still uses. They already differ slightly:copyWidgetremoves nested padding recursively, while$removeLineWidgetsunwraps one level. A shared helper would keep them from drifting further.PaddingPlan.prototype.applycallssession.$resetRowCache(0)and then emitschangeFoldfrom row 0, whoseEditSession.onChangeFoldhandler resets the cache again. The old code had the same pairing, so this is a nit.copySessionrelies on Ace's coordinate methods writing only to$docRowCacheand$screenRowCache. That's true of the bundled Ace, but a one-line comment stating the assumption would help whoever next upgrades Ace.- A simpler alternative could be to re-pad in place without signalling, compare against a saved copy of
lineWidgetsand the peek's loan fields, and restore the saved state if they match. This is a design trade-off, not a defect.
| ## RStudio 2026.12.0 "Parrot Balsam" Release Notes | ||
|
|
||
| ### New | ||
| - ([#19250](https://github.com/rstudio/rstudio/issues/19250)): The side-by-side Git diff view now avoids rebuilding alignment padding and redrawing both panes when an edit leaves the required padding unchanged. |
There was a problem hiding this comment.
The side-by-side view hasn't shipped yet: #19212 isn't in any release tag, and its user-facing entry is #19208. CLAUDE.md says not to add NEWS entries for fixes to unreleased features still under development, and the earlier follow-ups to this feature either amended the #19208 entry (#19350) or added none (#19225). Could this line be dropped? If the change should be mentioned, fold it into the #19208 entry instead.
Also, "avoids rebuilding alignment padding" isn't quite right: align() still computes the full padding plan on every realign, and what it skips is applying the plan and redrawing.
There was a problem hiding this comment.
Dropped in 6977f34. Agreed on both points: the view is unreleased, and the plan is still computed each realign; only the apply and redraw are skipped.
| try { | ||
| view.align(); | ||
| } catch (error) { | ||
| check("failed planning leaves the applied layout intact", view.sessionA.lineWidgets === widgetsBefore && | ||
| view.sessionA.$docRowCache === cacheBefore && peek.rowCount === 3 && peek.gitDiffLentRows === 2); | ||
| } |
There was a problem hiding this comment.
This check only runs if align() throws. If a later change makes align() catch planning errors, the assertion never runs and the page still passes. Could you record a flag in the catch and check it alongside the layout afterwards? For example:
var threw = false;
try {
view.align();
} catch (error) {
threw = true;
}
check("failed planning throws", threw);
check("failed planning leaves the applied layout intact", ...);There was a problem hiding this comment.
Done in 6977f34, with a separate "failed planning throws" assertion so a swallowed error fails the page too.
… cache assumption
|
On the optional points:
|
Typing inside an already modified line in the side-by-side Git diff used to rebuild padding, reset both sessions' row caches, and request full redraws even when the layout stayed the same.
Compute the required padding using separate widget data and row caches, compare it with the applied layout, and update only panes whose padding changes. This retains the existing placement rules for soft wrap, folds, notebook output, and rows borrowed by the change action bar. Comparing screen-row padding rather than chunk ranges ensures wrapping changes are still handled.
Closes #19250.
Validation:
main, versus zero on both panes with this change. Following lines stayed aligned and no browser errors occurred.git diff --checkpassed; NEWS links to the verified issue.