diff options
author | qepasa <pawelpalenica11@gmail.com> | 2021-10-12 14:37:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 22:37:54 +0100 |
commit | 0710594588aa768b934f925704dc57486dc0a157 (patch) | |
tree | 5b2cd4c9e94ecbda277454b77698ebaa837fab6c /zellij-tile/src | |
parent | a6453f111ea62e6332c919224d3a0fb19e35c249 (diff) |
feat(plugin): Add mouse events for plugins (#629)
* feat(plugin): Add mouse events for plugins
* Add double click support in strider
* Add support for mouse clicks in tab-bar and fix bug in strider with selecting past the list of files and random double click action
* continue working on mouse support for tab bar
* finish tab change
* fix fmt and fix bug in strider double-click
* fix clippy
* cleanup dbgs and logs
* fix clippy
* noop change to rerun e2e tests
* Rebase and fix mouse click behavior in tab-bar and strider after rebase
* fix fmt
* remove dbgs and and comment in tab-line/main.rs
* cargo fmt
* Code review suggestions
* rebase fix
* fix clippy
* fix mouse selection for tabs in tab-bar
Diffstat (limited to 'zellij-tile/src')
-rw-r--r-- | zellij-tile/src/data.rs | 11 | ||||
-rw-r--r-- | zellij-tile/src/shim.rs | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index 3e5062b92..c98ebb248 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -25,6 +25,16 @@ pub enum Key { Esc, } +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] + +pub enum Mouse { + ScrollUp(usize), // number of lines + ScrollDown(usize), // number of lines + LeftClick(isize, usize), // line and column + MouseHold(isize, usize), // line and column + MouseRelease(Option<(isize, usize)>), // line and column +} + #[derive(Debug, Clone, PartialEq, EnumDiscriminants, ToString, Serialize, Deserialize)] #[strum_discriminants(derive(EnumString, Hash, Serialize, Deserialize))] #[strum_discriminants(name(EventType))] @@ -33,6 +43,7 @@ pub enum Event { ModeUpdate(ModeInfo), TabUpdate(Vec<TabInfo>), KeyPress(Key), + Mouse(Mouse), Timer(f64), CopyToClipboard, InputReceived, diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index 6904d3f7d..c664d36b0 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -34,6 +34,10 @@ pub fn open_file(path: &Path) { unsafe { host_open_file() }; } +pub fn switch_tab_to(tab_idx: u32) { + unsafe { host_switch_tab_to(tab_idx) }; +} + pub fn set_timeout(secs: f64) { unsafe { host_set_timeout(secs) }; } @@ -63,6 +67,7 @@ extern "C" { fn host_set_selectable(selectable: i32); fn host_get_plugin_ids(); fn host_open_file(); + fn host_switch_tab_to(tab_idx: u32); fn host_set_timeout(secs: f64); fn host_exec_cmd(); } |