fix: scope mouse selection to focused pane in split mode#135
Merged
nick-skriabin merged 2 commits intomainfrom Mar 12, 2026
Merged
fix: scope mouse selection to focused pane in split mode#135nick-skriabin merged 2 commits intomainfrom
nick-skriabin merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cellIsSelected) extended from copy-mode-only to all split scenarioscopySelectionconverts global content-space coords to pane-local before reading from the pane's ring buffer