Skip to content

[diffs/edit] Use editor gutter interaction handler for line selection - #1005

Closed
ije wants to merge 2 commits into
beta-1.3from
ije/fix-gutter-select
Closed

[diffs/edit] Use editor gutter interaction handler for line selection#1005
ije wants to merge 2 commits into
beta-1.3from
ije/fix-gutter-select

Conversation

@ije

@ije ije commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

#979 fixed enableLineSelection and other file/diffs options that did have good compatibility with the editor. however the editor has the own gutter interaction handler.

this pr uses editor gutter interaction when a editor attached without changing the file/difss options, and the previous line selection remain.

@vercel

vercel Bot commented Jul 20, 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 20, 2026 7:37am
pierre-docs-diffshub Ready Ready Preview Jul 20, 2026 7:37am
pierre-docs-trees Ready Ready Preview Jul 20, 2026 7:37am
pierrejs-diff-demo Ready Ready Preview Jul 20, 2026 7:37am

Request Review

@ije
ije requested a review from amadeus July 20, 2026 06:14

@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: 0c5b998a42

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

private startLineSelectionFromPointerDown(event: PointerEvent): void {
const { enableLineSelection = false } = this.options;
if (!enableLineSelection) {
if (!enableLineSelection || this.hasEditorAttached) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve touch line selection while editing

When an editor is attached, this guard prevents the InteractionManager's normal line-selection path for every pointer type. The editor gutter handler that is supposed to take over only handles mouse pointers (it returns for touch/pen before resolving editable lines), so on touch/pen devices with enableLineSelection true, tapping or dragging the editable gutter in edit mode now neither updates editor selections nor fires line-selection callbacks; before this change the existing InteractionManager touch path handled those gestures. Consider letting non-mouse pointers continue through the existing line-selection path or adding touch support to the editor handler.

Useful? React with 👍 / 👎.

@amadeus

amadeus commented Jul 20, 2026

Copy link
Copy Markdown
Member

So I had made a bit of an intentional design decision here. If enableLineSelection was true, then you’d lose the editor line selection functionality. You also don’t need to use that prop to make line selections because it can be done programmatically or via gutter utility.

I think this makes for a cleaner separation of concerns, and if devs want the edit line selection they could toggle the prop when editing

@ije ije closed this Jul 20, 2026
@ije

ije commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

i see! i create another pr for fixing the selection rounded corner rendering with selected lines in #1007

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.

2 participants