fix(host-linux): make ctrl+w close the active tab, not the pane#101
fix(host-linux): make ctrl+w close the active tab, not the pane#101tnfssc wants to merge 2 commits into
Conversation
GLArea::allocation() returns CSS/logical pixels, but ghostty_surface_set_size expects physical device pixels. On HiDPI screens this caused the terminal to render at a fraction of the GL viewport or with a zero-size grid. Changes: - Introduce gl_area_device_size() helper to convert logical allocation to device pixels (allocation * scale_factor). - Use explicit device_width/device_height parameter names in refresh_surface_display and add rustdoc to prevent accidental logical-pixel usage. - Add connect_scale_factor_notify handler with a last-device-size cache to avoid redundant refresh/render cycles when the notify fires without an actual size change.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adjusts how the focused terminal “close” action behaves (closing the active tab instead of removing the entire pane), and improves Ghostty surface sizing by consistently using device-pixel dimensions under GTK scaling.
Changes:
- Update
close_focused_tabto close the active tab in the focused pane. - Add pane helpers to query the active tab and close a specific tab while respecting pinned tabs.
- Convert GLArea logical allocation sizes to device pixels and refresh Ghostty surfaces on scale-factor changes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rust/limux-host-linux/src/window.rs | Changes close behavior from pane removal to active-tab closure. |
| rust/limux-host-linux/src/terminal.rs | Uses device-pixel sizing for Ghostty and refreshes on scale-factor changes. |
| rust/limux-host-linux/src/pane.rs | Adds helper APIs for active tab lookup and tab closing within a pane. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The CloseFocusedPane shortcut (bound to Ctrl+w by default) was implemented as close_focused_tab(), but it actually called remove_pane() which removed the entire pane instead of the active tab within it. Changes: - Add active_tab_in_pane() and close_tab_in_pane() helpers in pane.rs so the window layer can query and close the active tab directly. - Rewrite close_focused_tab() to close the active tab in the focused pane via the new helpers. When the last tab is closed, the pane already invokes its on_empty callback (which removes the pane), so no extra logic is needed. - Remove the now-unused remove_pane() wrapper.
|
Thanks @tnfssc for the PR and for calling out the pane-vs-tab close bug. I did not merge #101 directly because the canonical fix needed the shortcut registry/config path and broader terminal passthrough changes, but the close-tab helper shape and final-pane/pinned-tab concerns were incorporated. Merged to
Please test the next update if you can. Thanks again. |
The
CloseFocusedPaneshortcut (bound to Ctrl+w by default) was implemented asclose_focused_tab(), but it actually calledremove_pane()which removed the entire pane instead of the active tab within it.Changes:
active_tab_in_pane()andclose_tab_in_pane()helpers inpane.rsso the window layer can query and close the active tab directly.close_focused_tab()to close the active tab in the focused pane via the new helpers. When the last tab is closed, the pane already invokes itson_emptycallback (which removes the pane), so no extra logic is needed.remove_pane()wrapper.Depends on #95.