Skip to content

Commit aea18cd

Browse files
committed
fix bug with selection for multipanels
1 parent 054a2b2 commit aea18cd

File tree

1 file changed

+12
-1
lines changed
  • frontends/rioterm/src/layout

1 file changed

+12
-1
lines changed

frontends/rioterm/src/layout/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,18 @@ impl<T: rio_backend::event::EventListener> ContextGrid<T> {
10941094
}
10951095

10961096
if let Some(current_item) = self.inner.get(&self.current) {
1097-
(&current_item.val, self.scaled_margin)
1097+
// For multi-panel layouts, the margin must include the panel's
1098+
// absolute offset so that mouse coordinates (which are relative
1099+
// to the window) are correctly translated to panel-local grid
1100+
// positions.
1101+
let [abs_x, abs_y, _, _] = current_item.layout_rect;
1102+
let margin = Margin {
1103+
left: self.scaled_margin.left + abs_x,
1104+
top: self.scaled_margin.top + abs_y,
1105+
right: self.scaled_margin.right,
1106+
bottom: self.scaled_margin.bottom,
1107+
};
1108+
(&current_item.val, margin)
10981109
} else {
10991110
tracing::error!("Current key {:?} not found in grid", self.current);
11001111
if let Some(root) = self.root {

0 commit comments

Comments
 (0)