Skip to content

Commit 67b2fcc

Browse files
committed
small fixes
1 parent 9b42a9e commit 67b2fcc

3 files changed

Lines changed: 27 additions & 11 deletions

File tree

frontends/rioterm/src/application.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,16 +1332,17 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
13321332
}
13331333
}
13341334

1335-
// Check if mouse is over island and set cursor to default.
1336-
// Skip guard when island is hidden (hide_if_single + single tab).
1335+
// Only force the default cursor while the island is
1336+
// visible — when it's hidden (hide_if_single + single
1337+
// tab on macOS) the band at the top has no tabs to
1338+
// hover, and the I-beam from the terminal grid below
1339+
// should stay during top-edge drags.
13371340
use crate::renderer::island::ISLAND_HEIGHT;
13381341
let scale_factor = route.window.screen.sugarloaf.scale_factor();
13391342
let island_height_px = (ISLAND_HEIGHT * scale_factor) as f64;
13401343
let num_tabs = route.window.screen.ctx().len();
13411344
let nav = &route.window.screen.renderer.navigation;
1342-
let island_is_visible =
1343-
nav.is_enabled() && !(nav.hide_if_single && num_tabs <= 1);
1344-
if island_is_visible && y <= island_height_px {
1345+
if nav.island_visible(num_tabs) && y <= island_height_px {
13451346
route.window.winit_window.set_cursor(CursorIcon::Default);
13461347
return;
13471348
}

frontends/rioterm/src/screen/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,13 +2617,12 @@ impl Screen<'_> {
26172617

26182618
let window_width = self.sugarloaf.window_size().width;
26192619
let num_tabs = self.context_manager.len();
2620+
let island_visible = self.renderer.navigation.island_visible(num_tabs);
26202621

2621-
// Island is hidden when hide_if_single is set with a single tab.
2622-
if self.renderer.navigation.hide_if_single && num_tabs <= 1 {
2623-
return false;
2624-
}
2625-
2626-
// Check if the color picker is open and the click hits a swatch
2622+
// Check if the color picker is open and the click hits a swatch.
2623+
// Handled before the `island_visible` short-circuit so a picker
2624+
// left open across a tab-close (hide_if_single trip) can still
2625+
// be dismissed by clicking its swatches.
26272626
if let Some(ref mut island) = self.renderer.island {
26282627
if island.is_color_picker_open() {
26292628
let consumed = island.handle_color_picker_click(
@@ -2652,6 +2651,13 @@ impl Screen<'_> {
26522651
return false;
26532652
}
26542653

2654+
// Island isn't painted (hide_if_single + single tab on macOS).
2655+
// Nothing to click on, so let the caller route the event to the
2656+
// grid for selection / double-click maximize at the OS title bar.
2657+
if !island_visible {
2658+
return false;
2659+
}
2660+
26552661
// Handle double-click: toggle window maximization
26562662
if let ClickState::DoubleClick = self.mouse.click_state {
26572663
let is_maximized = window.is_maximized();

rio-backend/src/config/navigation.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ impl Navigation {
192192
pub fn is_enabled(&self) -> bool {
193193
self.mode == NavigationMode::Tab
194194
}
195+
196+
/// Whether the rio-rendered tab strip ("island") is actually painted
197+
/// this frame. Mirrors the gate at `island.rs:358` — input layers
198+
/// (click routing, cursor override) must agree with the renderer so
199+
/// the empty band over a hidden island doesn't intercept events.
200+
#[inline]
201+
pub fn island_visible(&self, num_tabs: usize) -> bool {
202+
self.is_enabled() && !(self.hide_if_single && num_tabs == 1)
203+
}
195204
}
196205

197206
#[cfg(test)]

0 commit comments

Comments
 (0)