Skip to content

fix: retain selected diff lines with runtime paint - #2939

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-2936
Oct 15, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-2936

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A runtime CSS anchor adds a part token to a syntax span in the selected diff line. When an earlier hunk arrives, lf-diff compared the live row's raw innerHTML with the fresh render, treated that paint token as changed file content, and replaced the row, clearing the reader's selection. The row comparison now ignores runtime paint while still comparing the file text and rendered markup; unchanged lines keep their DOM nodes during a source refresh.

The existing test_a_diff_refresh_keeps_a_selection_in_unchanged_lines failed on the earlier-hunk case before this change and passes with it. test_a_diff_refresh_keeps_the_readers_inspection also passes.

Closes #2936 — automated triage

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test check fails at the Prettier hook: it rewrites the new line comparator in lf-diff.js. I’ll apply that formatting and push the correction.

@leaf-agent
leaf-agent merged commit 2222fec into main Oct 15, 2026
2 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-2936 branch October 15, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci-fix: diff refresh intermittently drops a selection in unchanged text

1 participant