fix: correct zoom pane sizing for PTY resize and active rect highlight#347
Closed
Edemilorhea wants to merge 1 commit into
Closed
fix: correct zoom pane sizing for PTY resize and active rect highlight#347Edemilorhea wants to merge 1 commit into
Edemilorhea wants to merge 1 commit into
Conversation
psmux
pushed a commit
that referenced
this pull request
Jun 3, 2026
Owner
|
Hey @Edemilorhea, thanks for the careful diagnosis on this one and for tracking down both the active_rect highlight offset AND the PTY sizing mismatch in resize_all_panes. Both intentional hunks landed on master in 6a20f48 (rebased onto current main so the recent #345 UTF-8 cursor fix and the zoom_cursor_rect work from 0aba873 stay intact). I added a small follow-up regression test in a8cf04c that asserts the active zoomed pane reports the full 120x40 viewport (was 118x38 before your fix because of the gap + min-size steal you correctly identified). Closing this PR since the rebase + merge is already in. Really appreciate the contribution. |
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.
Problem
When a pane is zoomed, the non-active pane (bottom pane in horizontal split, right pane in vertical split) would appear visually shifted by a few pixels in height/width. The border highlight and cursor position of the zoomed pane were also slightly misaligned.
Root Cause
Two separate but related issues:
compute_active_rect_json was used to compute active_rect for border highlighting and cursor positioning. This function internally calls split_with_gaps, which subtracts 1px gap per separator and returns child rects with offsets applied. However, when a pane is zoomed, the renderer passes the full content_chunk area to the child — ignoring gaps. The mismatch between what the renderer drew and what active_rect computed caused the visual shift.
In resize_all_panes, when a pane is zoomed, the PTY was being resized to the gap-reduced rect instead of the full viewport area. This meant the zoomed pane's PTY dimensions didn't match what was actually rendered on screen.
Solution
src/client.rs — Replace compute_active_rect_json with the zoom-aware variant:
// Before
let active_rect = compute_active_rect_json(&root, content_chunk);
// After
let active_rect = compute_active_rect_json_zoom_aware(&root, content_chunk, state.zoomed);
When state.zoomed is set, compute_active_rect_json_zoom_aware returns the full content_chunk directly, matching what the renderer actually uses.
src/tree.rs — In resize_all_panes, when win.zoom_saved.is_some(), override the active pane's rect to the full area before sending the PTY resize signal, so the zoomed pane gets the correct full-viewport dimensions.
Impact