Skip to content

Commit

Permalink
Let Neovim determine the mouse grid when composition is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
fredizzimo committed Jan 2, 2025
1 parent 5ad3878 commit 40afbc1
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/window/mouse_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct DragDetails {
struct EditorState<'a> {
grid_scale: &'a GridScale,
window_regions: &'a Vec<WindowDrawDetails>,
full_region: WindowDrawDetails,
window: &'a Window,
keyboard_manager: &'a KeyboardManager,
}
Expand Down Expand Up @@ -104,14 +105,17 @@ impl MouseManager {
editor_state: &'a EditorState<'a>,
) -> Option<&'a WindowDrawDetails> {
let position = self.window_position;

// the rendered window regions are sorted by draw order, so the earlier windows in the
// list are drawn under the later ones
editor_state
.window_regions
.iter()
.filter(|details| details.region.contains(&position))
.last()
if self.use_composition {
Some(&editor_state.full_region)
} else {
// the rendered window regions are sorted by draw order, so the earlier windows in the
// list are drawn under the later ones
editor_state
.window_regions
.iter()
.filter(|details| details.region.contains(&position))
.last()
}
}

fn get_relative_position(
Expand Down Expand Up @@ -395,9 +399,14 @@ impl MouseManager {
renderer: &Renderer,
window: &Window,
) {
let full_region = WindowDrawDetails {
id: 0,
region: renderer.window_regions.first().map_or(PixelRect::ZERO, |v| v.region)
};
let editor_state = EditorState {
grid_scale: &renderer.grid_renderer.grid_scale,
window_regions: &renderer.window_regions,
full_region,
window,
keyboard_manager,
};
Expand Down

0 comments on commit 40afbc1

Please sign in to comment.