Skip to content

Add shift range text selection #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MoeidHeidari
Copy link

Description

Implements shift+click selection behavior in the terminal to allow extending selections from the current cursor position or existing selection.

Related Issue

Closes #205

Changes Made

  • Added new SelectionMode.shift enum value to support shift+click selection behavior
  • Implemented shift+click selection handling in TerminalGestureHandler
  • Added keyboard event handling for shift key state tracking
  • Improved selection direction handling to maintain consistent selection direction when extending selections
  • Added proper handling of cursor position when no selection exists

Technical Details

  • Added shift key state tracking using HardwareKeyboard events
  • Implemented selection extension logic that:
    • Uses cursor position as anchor when no selection exists
    • Uses existing selection's start point as anchor when extending
    • Maintains selection direction (forward/reverse) when extending
  • Added proper handling of selection modes (line, block, shift) in the gesture handler

Testing

  • Tested shift+click selection with:
    • No existing selection (uses cursor position)
    • Existing selection (extends from selection start)
    • Different selection directions (forward/reverse)
    • Different selection modes (line/block)
  • Verified selection behavior with:
    • Single clicks
    • Drag operations
    • Long press operations

Additional Notes

  • No breaking changes
  • Improves user experience by making text selection more intuitive
  • Follows common terminal selection behavior patterns

@MoeidHeidari
Copy link
Author

No update?

@xtyxtyx xtyxtyx self-assigned this Jun 12, 2025
@MoeidHeidari
Copy link
Author

I think the last commit should fix the issue in GitHub actions

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.

Add Shift-Click Selection Support for Terminal Text
2 participants