Skip to content

feat(codemirror): shift + click selection#1899

Merged
bajrangCoder merged 2 commits intoAcode-Foundation:mainfrom
Autist1Coder:shift-tap-fix
Feb 25, 2026
Merged

feat(codemirror): shift + click selection#1899
bajrangCoder merged 2 commits intoAcode-Foundation:mainfrom
Autist1Coder:shift-tap-fix

Conversation

@Autist1Coder
Copy link
Copy Markdown
Contributor

@Autist1Coder Autist1Coder commented Feb 25, 2026

Closes: #1897

Recording.at.February25-084554am.3.mp4

@Autist1Coder Autist1Coder changed the title fix(codemirror): shift + click selection feat(codemirror): shift + click selection Feb 25, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

This PR implements shift+click selection functionality for the CodeMirror editor by adding a custom DOM event handler extension.

The implementation captures the selection anchor on pointerup when shift is pressed (either via event.shiftKey or the quickTools shift button at quickTools.$footer.dataset.shift), then extends the selection on the subsequent click event. The extension uses pointer ID mapping to track individual pointers and includes automatic cleanup via a 1001ms timeout to prevent memory leaks from stale entries.

Key changes:

  • Imports EditorSelection from @codemirror/state
  • Adds shiftClickSelectionExtension with pointerup and click handlers
  • Uses pointer ID mapping to associate pointerup events with click events
  • Includes safety checks for trusted and primary pointer events only
  • Integrated into editor initialization in two locations (lines 764 and 1128)

Confidence Score: 4/5

  • This PR is safe to merge with low risk - implements a focused bug fix for shift+click selection
  • The change is a targeted fix that adds missing shift+click selection functionality. The implementation follows CodeMirror patterns, includes appropriate safety checks (trusted/primary events), and has cleanup mechanisms. Minor confidence reduction due to the complexity of event timing between pointerup and click handlers, though the approach appears sound based on the codebase patterns.
  • No files require special attention

Important Files Changed

Filename Overview
src/lib/editorManager.js Added shift+click selection extension with pointer event handling to extend selections, includes timeout-based cleanup mechanism

Last reviewed commit: f205140

@bajrangCoder
Copy link
Copy Markdown
Member

Also add a editor setting to toggle this behaviour

@Autist1Coder Autist1Coder force-pushed the shift-tap-fix branch 2 times, most recently from a3cad81 to b5f3320 Compare February 25, 2026 09:16
@bajrangCoder bajrangCoder merged commit 10ee055 into Acode-Foundation:main Feb 25, 2026
6 checks passed
@Autist1Coder Autist1Coder deleted the shift-tap-fix branch February 25, 2026 10:06
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.

shift + tapping text selects nothing

3 participants