Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions cmux-tui/crates/cmux-tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5799,6 +5799,7 @@ struct RenderedPointerFrame {
machine_rail: Option<Rect>,
workspace_rail: Option<Rect>,
tabs_rail: Option<Rect>,
projection_rails: Arc<[(RailKind, Rect)]>,
hits: Arc<[RenderedHitRoute]>,
panes: Arc<[RenderedPaneRoute]>,
terminal_pointer_semantics: Arc<HashMap<SurfaceId, TerminalPointerSemanticSnapshot>>,
Expand Down Expand Up @@ -5915,6 +5916,18 @@ impl RenderedPointerFrame {
};
}
}
if let Some((kind, rect)) =
self.projection_rails.iter().copied().find(|(_, rect)| rect.contains(x, y))
{
if !self.panes.iter().any(|pane| pane.content.contains(x, y)) {
return PointerRouteIdentity::Rail {
kind,
rect,
column: x.saturating_sub(rect.x),
row: y.saturating_sub(rect.y),
};
}
}
if let Some(pane) = self.panes.iter().find(|pane| pane.rect.contains(x, y)) {
let region = if pane.content.contains(x, y) {
match pane.kind {
Expand Down Expand Up @@ -12062,6 +12075,16 @@ impl App {
let machine_rail = self.sidebar_layout.machine;
let workspace_rail = self.sidebar_layout.workspace;
let tabs_rail = self.sidebar_layout.tabs;
let projection_rails = self
.sidebar_layout
.ordered
.iter()
.filter_map(|placement| match placement.kind {
RailKind::Projection(_) => Some((placement.kind, placement.rect)),
_ => None,
})
.collect::<Vec<_>>()
.into();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
let pointer_map_generation = self.session.pointer_map_generation();
let reuse_owners = action == RenderAction::Paint
&& self.rendered_pointer_frame.pointer_map_generation == pointer_map_generation;
Expand Down Expand Up @@ -12145,6 +12168,7 @@ impl App {
machine_rail,
workspace_rail,
tabs_rail,
projection_rails,
hits,
panes,
terminal_pointer_semantics,
Expand Down Expand Up @@ -30885,6 +30909,49 @@ mod tests {
);
}

#[test]
fn pointer_routes_projection_rail_padding_to_projection_rail() {
let rect = Rect { x: 4, y: 0, width: 20, height: 10 };
let pane = PaneArea {
pane: 7,
surface: 9,
rect,
bar: None,
omnibar: None,
content: Rect { x: 5, y: 1, width: 18, height: 8 },
track: None,
viewport: None,
};
let mux = Mux::new("projection-rail-pointer-frame-test", SurfaceOptions::default());
let mut app = test_app(Session::Local(mux));
app.outer_size = (40, 10);
app.sidebar_layout.ordered =
vec![super::RailPlacement { kind: RailKind::Projection(0), view_index: 0, rect }];
app.pane_areas = vec![pane];
app.commit_rendered_pointer_frame();

let padding_route = app.rendered_pointer_frame.route_for_mouse(&MouseEvent {
kind: MouseEventKind::Down(MouseButton::Left),
column: rect.x + rect.width - 1,
row: rect.y + rect.height - 1,
modifiers: KeyModifiers::NONE,
});
assert!(matches!(
padding_route,
PointerRouteIdentity::Rail { kind: RailKind::Projection(0), .. }
));

let content_route = app.rendered_pointer_frame.route_for_mouse(&MouseEvent {
kind: MouseEventKind::Down(MouseButton::Left),
column: pane.content.x,
row: pane.content.y,
modifiers: KeyModifiers::NONE,
});
assert!(
matches!(content_route, PointerRouteIdentity::Pane { pane: routed, .. } if routed.pane == pane.pane)
);
}

#[test]
fn graphics_only_repaint_is_a_pointer_replay_barrier() {
assert_eq!(
Expand Down
Loading