Skip to content

fix: clip mouse selection copy to pane#327

Merged
psmux merged 1 commit into
psmux:masterfrom
burakkose:bk/fix-pane-clipped-selection-copy
May 28, 2026
Merged

fix: clip mouse selection copy to pane#327
psmux merged 1 commit into
psmux:masterfrom
burakkose:bk/fix-pane-clipped-selection-copy

Conversation

@burakkose

Copy link
Copy Markdown
Contributor

Summary

Fixes pwsh-mouse-selection clipboard extraction so multi-line mouse selections are clipped to the originating pane, matching the visible selection overlay.

Previously, the overlay was pane-clipped but Ctrl+C, Ctrl+Shift+C, right-click copy, and legacy copy-on-release could still extract full terminal-width intermediate rows, which could include text from neighboring panes.

Related to #211

Approach

  • Thread the originating pane rect into mouse-selection text extraction.
  • Intersect each selected row with that pane rect before reading cells from the layout tree.
  • Preserve existing behavior when no pane clip is provided.

Tests

  • cargo test -q extract_selection_text

Use the originating pane rect when extracting mouse selections so multi-line clipboard copies cannot include neighboring panes.

Add coverage for reading-order and block selections that cross split boundaries.
@burakkose burakkose force-pushed the bk/fix-pane-clipped-selection-copy branch from 23a02f1 to f18f73e Compare May 27, 2026 22:36
@psmux psmux merged commit 55f1f4a into psmux:master May 28, 2026
@psmux

psmux commented May 28, 2026

Copy link
Copy Markdown
Owner

Nice catch @burakkose, and solid implementation.

Verified this against tmux's behavior. In tmux, each pane operates on its own backing screen (sized to the pane, not the terminal), so multi line selections naturally stay within pane boundaries. psmux was doing the overlay clipping correctly (the visual highlight was confined to the pane) but the actual text extraction for clipboard was reading the full terminal width on intermediate rows.

Your approach of threading the originating pane rect into �xtract_selection_text and intersecting each row with that rect is clean and correct. The selection_row_cols helper is well structured. Tests cover both reading order and block mode across a split boundary, which is exactly what was needed.

All 2030 existing unit tests pass with zero regressions. Merged.

Thanks for the contribution!

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