Skip to content

Add Shift+Click to extend terminal text selection (iTerm2-style)#11933

Open
cola-runner wants to merge 2 commits into
warpdotdev:masterfrom
cola-runner:shift-click-extend-selection
Open

Add Shift+Click to extend terminal text selection (iTerm2-style)#11933
cola-runner wants to merge 2 commits into
warpdotdev:masterfrom
cola-runner:shift-click-extend-selection

Conversation

@cola-runner

@cola-runner cola-runner commented May 30, 2026

Copy link
Copy Markdown

Summary

Adds iTerm2-style Shift+Click to extend a terminal text selection. With a selection already present, Shift + left-click moves the nearest selection boundary to the clicked point:

  • clicking before the selection extends the start/head side
  • clicking after the selection extends the end/tail side
  • clicking inside the selection shrinks whichever side is closer

A plain click still starts a new selection, and Shift+Click+drag can continue fine-tuning the extended text selection. This makes selecting long / multi-screen output much easier: pick a start, scroll, then Shift+Click the other side instead of drag-and-auto-scrolling the whole way.

Closes #3426

(Supersedes the duplicate reports #11932, #9963, and #4715 -- same iTerm2-style Shift+Click extend behavior.)

How it works

The shared selection model now exposes nearest-boundary extension logic, so block-list and alt-screen selections use the same behavior.

  • Selection model (selection.rs): adds reusable nearest-boundary logic for moving start vs end when extending.
  • Block list (block_list_element.rs, view.rs): Shift+Click dispatches Extend when a simple text selection already exists and the click is not on a link / revealed secret. Shift+Click+drag continues dispatching text-selection updates instead of being misclassified as block selection.
  • Alt screen (alt_screen_element.rs, alt_screen.rs, view.rs): Shift+Click extension is wired for full-screen apps as well.

Scope / follow-ups

  • AI rich-content block internal selections are intentionally left out of scope for this PR because they are implemented differently.

Testing

Verified after rebasing onto latest upstream/master (f554cf76) with this PR applied:

  • cargo test -p warp nearest_boundary --lib -- 10 passed
  • cargo test -p warp test_alt_screen_extend_selection_without_existing_selection_noops --lib -- 1 passed
  • cargo check -p warp

Earlier macOS GUI evidence for the cross-screen block-list workflow is here: https://gist.github.com/cola-runner/37a80d8cf984abe661964e1b9d3fa9a9

Generated with Claude Code

@cla-bot

cla-bot Bot commented May 30, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @cola-runner on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@oz-for-oss

oz-for-oss Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

@cola-runner

This PR is not linked to an issue that is marked with ready-to-implement.

Issue-state enforcement details:

Readiness check:

To continue, link this PR to a same-repo issue such as Closes #123 in the PR description, and make sure that issue has ready-to-implement.

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 30, 2026
oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 30, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@cola-runner

This PR is not linked to an issue that is marked with ready-to-implement.

Issue-state enforcement details:

  • Associated same-repo issues checked: #11932

  • Required readiness label: ready-to-implement

Readiness check:

  • #11932: missing ready-to-implement; readiness labels present: none

To continue, link this PR to a same-repo issue such as Closes #123 in the PR description, and make sure that issue has ready-to-implement.

Powered by Oz

@cola-runner

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Jun 1, 2026
@cla-bot

cla-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@cola-runner

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss

oz-for-oss Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@cola-runner

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes Jun 1, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR adds a feature-flagged Shift+Click path that extends an existing block-list terminal text selection by updating the selection tail, plus the supporting selection action and feature-flag wiring. No approved spec context was available, and I did not find security concerns in the changed code.

Concerns

  • For this user-facing terminal selection behavior, the PR does not include screenshots or a screen recording demonstrating the end-to-end interaction, and the description says the GUI has not been manually exercised. Please attach visual evidence from a desktop run or from a coding agent with computer use enabled.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Hi @cola-runner — a reviewer requested changes on this PR and it hasn't had activity from you in 7 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 30 days of inactivity.

@cola-runner cola-runner force-pushed the shift-click-extend-selection branch from 7ac3967 to 23781d2 Compare June 10, 2026 08:11
@oz-for-oss

oz-for-oss Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@cola-runner

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes Jun 11, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR adds a feature-flagged Shift+Click path that extends an existing terminal text selection by dispatching a new SelectAction::Extend/BlockTextSelectAction::Extend variant and updating the block-list selection tail.

Concerns

  • Shift+Click followed by dragging appears to lose the promised fine-tuning behavior because the existing drag handler treats held Shift as block-selection mode and suppresses text-selection updates.
  • No security findings.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/terminal/block_list_element.rs
@cola-runner

Copy link
Copy Markdown
Author

Updated the Testing section with macOS GUI verification for the cross-screen workflow, and linked the reviewed evidence:

https://gist.github.com/cola-runner/37a80d8cf984abe661964e1b9d3fa9a9

/oz-review

@oz-for-oss

oz-for-oss Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@cola-runner

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @seemeroland.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed stale reviews from themself June 11, 2026 03:42

Oz no longer requests changes for this pull request after the latest automated review.

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR adds a feature-flagged Shift+Click path for extending existing block-list terminal text selections, adds the corresponding SelectAction::Extend handling, and wires the new compile-time feature flag into the app feature initialization. The PR description includes visual evidence for the user-facing behavior, and no approved spec context was provided for implementation drift checks.

Concerns

  • No blocking correctness, security, or spec-alignment concerns found in the changed lines.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot requested a review from seemeroland June 11, 2026 03:42

@seemeroland seemeroland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for taking a stab at this!

Comment thread app/src/terminal/view.rs
Comment thread app/Cargo.toml Outdated
Comment thread app/src/terminal/view.rs Outdated
Comment thread app/src/terminal/view.rs Outdated
@cola-runner cola-runner force-pushed the shift-click-extend-selection branch from 23781d2 to 3342f80 Compare June 12, 2026 04:51
@cola-runner

Copy link
Copy Markdown
Author

Updated this PR on top of latest master (a30cc7a3) and addressed the review feedback:

  • changed Shift+Click extension to move the nearest selection boundary, matching iTerm2 behavior for extending before/after the selection and shrinking from inside it
  • shared the nearest-boundary logic between block-list and alt-screen selections
  • wired Shift+Click extension for alt screen selections
  • removed the compile-time feature flag from the final diff
  • changed the no-selection Extend fallback to no-op with a comment, since Extend should only be dispatched when a selection exists
  • kept Shift+Click+drag as a text-selection update path so the extended selection can still be fine-tuned while Shift is held

Validation on latest master plus this PR:

  • cargo test -p warp nearest_boundary --lib (6 passed)
  • cargo check -p warp

@cola-runner

Copy link
Copy Markdown
Author

Added another small test-only commit for edge coverage:

  • same-row shrinking uses column distance to pick the nearest boundary
  • reversed block-list selections update the correct stored anchor/tail
  • block-list and alt-screen Extend no-op when no selection exists

Validation after the test commit:

  • cargo test -p warp nearest_boundary --lib (10 passed)
  • cargo test -p warp test_alt_screen_extend_selection_without_existing_selection_noops --lib (1 passed)
  • cargo check -p warp

@cola-runner

Copy link
Copy Markdown
Author

Hi @seemeroland, I addressed your review feedback in the latest updates:

  • Shift+Click now moves the nearest selection boundary, including shrinking from inside the current selection.
  • Block-list and alt-screen selections share the nearest-boundary logic.
  • Alt-screen Shift+Click extension is wired.
  • The compile-time feature flag was removed.
  • Extend without an existing selection now no-ops.
  • Shift+Click+drag can continue fine-tuning the extended text selection while Shift is held.
  • Added edge tests for same-row shrink behavior, reversed block-list selections, and no-selection no-op behavior.

Validation:

  • cargo test -p warp nearest_boundary --lib (10 passed)
  • cargo test -p warp test_alt_screen_extend_selection_without_existing_selection_noops --lib (1 passed)
  • cargo check -p warp
  • GitHub CI is green on the current head (352260410bda3d935c2e7c295555657e12923d20).

Would you mind taking another look when you have a chance?

Move Shift+Click extension into shared selection-model logic that updates the nearest boundary, wire it through block-list and alt-screen selections, and keep Shift+Click+drag updating text selection.

Add unit coverage for extending before/after selections and shrinking from inside the current range.
Cover same-row nearest-boundary shrink behavior, reversed block-list selections, and no-op extension when no selection exists.
@cola-runner cola-runner force-pushed the shift-click-extend-selection branch from 3522604 to 8ccfbbe Compare June 26, 2026 09:45
@cola-runner

Copy link
Copy Markdown
Author

Hi @seemeroland, following up here. I rebased this PR onto latest master (f554cf76) and re-ran the local validation:

  • cargo test -p warp nearest_boundary --lib (10 passed)
  • cargo test -p warp test_alt_screen_extend_selection_without_existing_selection_noops --lib (1 passed)
  • cargo check -p warp

All previous review threads are resolved, and the current head is 8ccfbbecc97f3ac907b78b45de5d0853148b3644.

cc @harryalbert @adrawbond-alto @BobbyWang0120 since you have recently touched nearby terminal view / mouse dispatch / terminal event paths. Would one of you be able to take a look or help route this to the right owner?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shift+click for text selection doesn't work

2 participants