Skip to content

Commit bb337b9

Browse files
committed
fix position offset when switching between tabs
1 parent f15fb1c commit bb337b9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • frontends/rioterm/src/layout

frontends/rioterm/src/layout/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,21 @@ impl<T: rio_backend::event::EventListener> ContextGrid<T> {
908908
let is_multi_panel = self.inner.len() > 1;
909909

910910
for item in self.inner.values_mut() {
911-
let [abs_x, abs_y, width, height] = item.layout_rect;
911+
// Single panel: ignore Taffy panel margin offset, use full available area
912+
let [abs_x, abs_y, width, height] = if is_multi_panel {
913+
item.layout_rect
914+
} else {
915+
[
916+
0.0,
917+
0.0,
918+
self.width - self.scaled_margin.left - self.scaled_margin.right,
919+
self.height - self.scaled_margin.top - self.scaled_margin.bottom,
920+
]
921+
};
912922

913923
let x = (abs_x + self.scaled_margin.left) / scale;
914924
let y = (abs_y + self.scaled_margin.top) / scale;
915925

916-
// Clear margin since Taffy layout already accounts for spacing
917926
item.val.dimension.margin = Margin::all(0.0);
918927
item.val.dimension.update_width(width);
919928
item.val.dimension.update_height(height);

0 commit comments

Comments
 (0)