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