Skip to content

fix: scope mouse selection to focused pane in split mode#135

Merged
nick-skriabin merged 2 commits intomainfrom
fb-selection-scoping
Mar 12, 2026
Merged

fix: scope mouse selection to focused pane in split mode#135
nick-skriabin merged 2 commits intomainfrom
fb-selection-scoping

Conversation

@nick-skriabin
Copy link
Contributor

@nick-skriabin nick-skriabin commented Mar 12, 2026

Summary

  • Mouse selection now stays within the focused pane instead of spanning across all panes in split mode
  • Renderer clipping (cellIsSelected) extended from copy-mode-only to all split scenarios
  • Mouse input handlers (macOS + Linux) clamp row/col to the focused pane rect during click and drag
  • copySelection converts global content-space coords to pane-local before reading from the pane's ring buffer

Copilot AI review requested due to automatic review settings March 12, 2026 23:49
@nick-skriabin nick-skriabin changed the title Fb selection scoping fix: scope mouse selection to focused pane in split mode Mar 12, 2026
@nick-skriabin nick-skriabin merged commit 997f3d5 into main Mar 12, 2026
4 checks passed
@nick-skriabin nick-skriabin deleted the fb-selection-scoping branch March 12, 2026 23:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts text selection behavior when split panes are active, scoping both rendering and clipboard-copying of selections to the focused pane.

Changes:

  • Convert global (split layout) selection coordinates to pane-local coordinates when copying selection text.
  • Clip selection highlighting to the focused pane when splits are active (not only in copy mode).
  • Clamp mouse selection start/end positions to the focused pane bounds during drag/select on macOS and Linux.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/app/ui/selection.zig Adjusts selection coordinate space for clipboard copy in split mode.
src/app/macos_renderer_draw.m Clips selection highlight to the focused pane when splits are active.
src/app/macos_input.m Clamps mouse selection coordinates to focused pane bounds in split mode.
src/app/linux_render_util.c Clips selection highlight to the focused pane when splits are active.
src/app/linux_input.c Clamps mouse selection coordinates to focused pane bounds in split mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +24 to +35
// Read and normalize selection bounds (viewport-relative).
// In split mode, coords are in global content-space — convert to pane-local.
var sr: i32 = c.g_sel_start_row;
var sc: i32 = c.g_sel_start_col;
var er: i32 = c.g_sel_end_row;
var ec: i32 = c.g_sel_end_col;
if (c.g_split_active != 0 and c.g_pane_rect_rows > 0) {
sr -= c.g_pane_rect_row;
er -= c.g_pane_rect_row;
sc -= c.g_pane_rect_col;
ec -= c.g_pane_rect_col;
}
Comment on lines +378 to +382
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +681 to +685
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +741 to +746
int pr = g_pane_rect_row, pc = g_pane_rect_col;
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +999 to +1003
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
nick-skriabin added a commit that referenced this pull request Mar 13, 2026
## Summary
- Mouse selection now stays within the focused pane instead of spanning
across all panes in split mode
- Renderer clipping (`cellIsSelected`) extended from copy-mode-only to
all split scenarios
- Mouse input handlers (macOS + Linux) clamp row/col to the focused pane
rect during click and drag
- `copySelection` converts global content-space coords to pane-local
before reading from the pane's ring buffer
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