|
|
|
@ -3,6 +3,8 @@ use nvim_rs::compat::tokio::Compat;
|
|
|
|
|
use nvim_rs::Neovim;
|
|
|
|
|
use tokio::process::ChildStdin;
|
|
|
|
|
|
|
|
|
|
use crate::editor::EDITOR;
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum UiCommand {
|
|
|
|
|
Resize {
|
|
|
|
@ -38,21 +40,30 @@ impl UiCommand {
|
|
|
|
|
UiCommand::MouseButton {
|
|
|
|
|
action,
|
|
|
|
|
position: (grid_x, grid_y),
|
|
|
|
|
} => nvim
|
|
|
|
|
.input_mouse("left", &action, "", 0, grid_y as i64, grid_x as i64)
|
|
|
|
|
.await
|
|
|
|
|
.expect("Mouse Input Failed"),
|
|
|
|
|
} => {
|
|
|
|
|
if { EDITOR.lock().mouse_enabled } {
|
|
|
|
|
nvim.input_mouse("left", &action, "", 0, grid_y as i64, grid_x as i64)
|
|
|
|
|
.await
|
|
|
|
|
.expect("Mouse Input Failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UiCommand::Scroll {
|
|
|
|
|
direction,
|
|
|
|
|
position: (grid_x, grid_y),
|
|
|
|
|
} => nvim
|
|
|
|
|
.input_mouse("wheel", &direction, "", 0, grid_y as i64, grid_x as i64)
|
|
|
|
|
.await
|
|
|
|
|
.expect("Mouse Scroll Failed"),
|
|
|
|
|
UiCommand::Drag(grid_x, grid_y) => nvim
|
|
|
|
|
.input_mouse("left", "drag", "", 0, grid_y as i64, grid_x as i64)
|
|
|
|
|
.await
|
|
|
|
|
.expect("Mouse Drag Failed"),
|
|
|
|
|
} => {
|
|
|
|
|
if { EDITOR.lock().mouse_enabled } {
|
|
|
|
|
nvim.input_mouse("wheel", &direction, "", 0, grid_y as i64, grid_x as i64)
|
|
|
|
|
.await
|
|
|
|
|
.expect("Mouse Scroll Failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UiCommand::Drag(grid_x, grid_y) => {
|
|
|
|
|
if { EDITOR.lock().mouse_enabled } {
|
|
|
|
|
nvim.input_mouse("left", "drag", "", 0, grid_y as i64, grid_x as i64)
|
|
|
|
|
.await
|
|
|
|
|
.expect("Mouse Drag Failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UiCommand::FocusLost => nvim
|
|
|
|
|
.command("if exists('#FocusLost') | doautocmd <nomodeline> FocusLost | endif")
|
|
|
|
|
.await
|
|
|
|
|