Skip to content

[diffs/edit] No more required props (except useTokenTransform - #979

Merged
amadeus merged 9 commits into
beta-1.3from
amadeus/edit-fix-forced-options
Jul 16, 2026
Merged

[diffs/edit] No more required props (except useTokenTransform#979
amadeus merged 9 commits into
beta-1.3from
amadeus/edit-fix-forced-options

Conversation

@amadeus

@amadeus amadeus commented Jul 14, 2026

Copy link
Copy Markdown
Member

Made it so we can preserve all line selection, annotation and line highlights while in edit mode.

Of course a dev could still choose to change specific props on a per file basis if necessary.

  • - Test
  • - Update docs to reflect new world

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Ready Ready Preview Jul 16, 2026 10:23pm
pierre-docs-diffshub Ready Ready Preview Jul 16, 2026 10:23pm
pierre-docs-trees Ready Ready Preview Jul 16, 2026 10:23pm
pierrejs-diff-demo Ready Ready Preview Jul 16, 2026 10:23pm

Request Review

@amadeus

amadeus commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 8761b99e4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

amadeus added 8 commits July 16, 2026 15:18
Moving the caret in edit mode reused the selected-lines state, which could
replace an existing line selection and disturb its callbacks or gutter
utility.

Track the editor active line independently and derive one visual highlight
where selected lines take precedence. Preserve both states across diff row
refreshes so each retains its latest value.
Entering Edit mode with line selection, gutter utilities, or hover
highlighting enabled currently turns those interactions off and clears
selected lines.

Preserve the configured interaction options while enabling only the
token transformer required by the editor. Keep editor active-line
styling separate from selected-line styling, protect gutter utility
gestures from editor selection handlers, and exercise the behavior
across playground views.
Update editor documentation and live examples to stop disabling gutter
utilities, line selection, and hover highlighting in edit mode.

Keep useTokenTransformer enabled in prerendered examples because the
editor still requires it, and refresh the generated homepage fixture.
Dragging a gutter utility now updates the line range and selection
lifecycle even when ordinary line selection is disabled. Ordinary gutter
drags remain disabled, and callbacks retain the completed gesture range
when utility code changes the current selection.

Preserve editor text selections during gutter-owned gestures and render
the cursor line independently from selected diff lines. Retry incomplete
renders, avoid rewriting unchanged ranges, and keep both states visible
across supported themes.
Clarify that gutter utility gestures emit selection lifecycle callbacks
even when ordinary line selection is disabled.
Added and deleted gutter numbers kept their base colors on the editor
cursor line because the Agent UI override excluded the obsolete
`data-active` attribute.

Exclude `data-editor-active-line` instead and update the generated demo
snapshot so the editor active-line styling can apply.
Select a line in edit mode and move the cursor onto it: the theme current-line background can obscure the selection and addition or deletion color.

Resolve decoration, diff, selection, editor active, and hover colors as ordered layers. Derive active emphasis from the resolved semantic color, retain theme borders as a fallback cue, and prevent gutter numbers from receiving the selection mix twice.
@amadeus
amadeus force-pushed the amadeus/edit-fix-forced-options branch from 20a1e2a to 21b162f Compare July 16, 2026 22:21
@amadeus

amadeus commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21b162f215

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/diffs/src/components/FileDiff.ts
Edit inside a collapsed diff region, then move the caret or update the
line selection: virtualized views can keep showing the previous line
state after rebuilding their rows.

Flush deferred selected and active-line writes after virtualized
managers bind to the rebuilt DOM, and cover the region-changing render
path.
@amadeus

amadeus commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 72f4699f14

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@amadeus
amadeus merged commit f1ee8a2 into beta-1.3 Jul 16, 2026
2 checks passed
@amadeus
amadeus deleted the amadeus/edit-fix-forced-options branch July 16, 2026 22:57
amadeus added a commit that referenced this pull request Jul 21, 2026
* fix(diffs): Keep editor active line separate from selected lines

Moving the caret in edit mode reused the selected-lines state, which could
replace an existing line selection and disturb its callbacks or gutter
utility.

Track the editor active line independently and derive one visual highlight
where selected lines take precedence. Preserve both states across diff row
refreshes so each retains its latest value.

* fix(diffs): Preserve interactions in edit mode

Entering Edit mode with line selection, gutter utilities, or hover
highlighting enabled currently turns those interactions off and clears
selected lines.

Preserve the configured interaction options while enabling only the
token transformer required by the editor. Keep editor active-line
styling separate from selected-line styling, protect gutter utility
gestures from editor selection handlers, and exercise the behavior
across playground views.

* docs(diffs): Remove obsolete editor option overrides

Update editor documentation and live examples to stop disabling gutter
utilities, line selection, and hover highlighting in edit mode.

Keep useTokenTransformer enabled in prerendered examples because the
editor still requires it, and refresh the generated homepage fixture.

* fix(diffs): Keep text and line selections independent

Dragging a gutter utility now updates the line range and selection
lifecycle even when ordinary line selection is disabled. Ordinary gutter
drags remain disabled, and callbacks retain the completed gesture range
when utility code changes the current selection.

Preserve editor text selections during gutter-owned gestures and render
the cursor line independently from selected diff lines. Retry incomplete
renders, avoid rewriting unchanged ranges, and keep both states visible
across supported themes.

* docs(diffs): Document gutter utility selection callbacks

Clarify that gutter utility gestures emit selection lifecycle callbacks
even when ordinary line selection is disabled.

* fix(docs): Respect editor active lines in Agent UI

Added and deleted gutter numbers kept their base colors on the editor
cursor line because the Agent UI override excluded the obsolete
`data-active` attribute.

Exclude `data-editor-active-line` instead and update the generated demo
snapshot so the editor active-line styling can apply.

* Fix playground with new selection states

* fix(diffs): Compose editor active lines with diff states

Select a line in edit mode and move the cursor onto it: the theme current-line background can obscure the selection and addition or deletion color.

Resolve decoration, diff, selection, editor active, and hover colors as ordered layers. Derive active emphasis from the resolved semantic color, retain theme borders as a fallback cue, and prevent gutter numbers from receiving the selection mix twice.

* fix(diffs): Flush line state after virtualized rerenders

Edit inside a collapsed diff region, then move the caret or update the
line selection: virtualized views can keep showing the previous line
state after rebuilding their rows.

Flush deferred selected and active-line writes after virtualized
managers bind to the rebuilt DOM, and cover the region-changing render
path.
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.

1 participant