Skip to content

fix(host-linux): make ctrl+w close the active tab, not the pane#101

Open
tnfssc wants to merge 2 commits into
am-will:mainfrom
tnfssc:shortcut-fix
Open

fix(host-linux): make ctrl+w close the active tab, not the pane#101
tnfssc wants to merge 2 commits into
am-will:mainfrom
tnfssc:shortcut-fix

Conversation

@tnfssc

@tnfssc tnfssc commented Jun 6, 2026

Copy link
Copy Markdown

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.

Depends on #95.

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.
Copilot AI review requested due to automatic review settings June 6, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_tab to 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.

Comment thread rust/limux-host-linux/src/window.rs
Comment thread rust/limux-host-linux/src/terminal.rs
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.
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