Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): Add mouse events for plugins #629

Merged
merged 18 commits into from
Oct 12, 2021

Conversation

qepasa
Copy link
Contributor

@qepasa qepasa commented Jul 27, 2021

Adds mouse events to zellij_tile::Event. Also, adds mouse scroll and mouse select in strider.

  • Implement some new functionality for tab-bar i.e. tab selection. If possible tab reordering would be nice (drag to change order of tab) (with current mouse handling it would be difficult to implement)
  • Double click for strider to open directory?

@qepasa qepasa changed the title feat(plugin): Add mouse events for plugins (WIP) feat(plugin): Add mouse events for plugins Jul 27, 2021
@TheLostLambda
Copy link
Member

This looks exciting! Let me know when things are ready for a review!

@qepasa qepasa changed the title (WIP) feat(plugin): Add mouse events for plugins feat(plugin): Add mouse events for plugins Aug 26, 2021
@qepasa
Copy link
Contributor Author

qepasa commented Aug 26, 2021

@TheLostLambda This should be ready for review.
Below is a video showing scroll functionality (strider), single click to select file/directory (strider), double click to open directory (strider) and left click to change tab (tab-bar)

cargo._home_pawel_Projects_zellij.2021-08-26.09-05-06.mp4

@TheLostLambda
Copy link
Member

@qepasa Sorry I missed your last message by so many days! I'll try to give this a full review tomorrow! Thanks for all of the hard work!

@qepasa
Copy link
Contributor Author

qepasa commented Sep 5, 2021

@qepasa Sorry I missed your last message by so many days! I'll try to give this a full review tomorrow! Thanks for all of the hard work!

Hey, no worries! I should have just pinged you on Zellij discord when I wrote that comment. Looking forward to your review. I guess some E2E tests would be nice to have some regression guards on this behavior (i.e. it broke at some point when borders were introduced). I can look into e2e tests as a follow up PR :)

Copy link
Member

@TheLostLambda TheLostLambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall! I've left a couple of comments and we need to fix a hard-crash / investigate some ClearScroll / isize things, but I'm happy to merge after that!

default-plugins/strider/src/main.rs Outdated Show resolved Hide resolved
default-plugins/strider/src/main.rs Show resolved Hide resolved
default-plugins/tab-bar/src/main.rs Outdated Show resolved Hide resolved
zellij-server/src/panes/plugin_pane.rs Show resolved Hide resolved
zellij-server/src/wasm_vm.rs Show resolved Hide resolved
zellij-tile/src/data.rs Show resolved Hide resolved
zellij-tile/src/data.rs Outdated Show resolved Hide resolved
@TheLostLambda
Copy link
Member

Hey @qepasa ! Just checking in! Is there anything more that you need from me to get this over the line? I feel like it's quite close to being mergable!

Thanks for everything you've done on it so far! :)

@a-kenji a-kenji mentioned this pull request Oct 5, 2021
Copy link
Member

@TheLostLambda TheLostLambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qepasa Thanks for all of the great work here! I've left a couple of comments as discussion points, but since I find them all rather minor nits and I want to get this merged for you, I'll clean them up in a commit to main!

If you disagree with any of these comments or think I'm missing something though, I'm happy to patch things up in a second, super small PR!

Thanks for adding this super useful functionality to Zellij!

}
}

fn render(&mut self, rows: usize, cols: usize) {
for i in 0..rows {
// If the key was pressed, set selected so that we can see the cursor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly confused by this comment, is it in the right place? I could just be missing something!

for bar_part in tab_line {
s = format!("{}{}", s, bar_part.part);
let mut len_cnt = 0;
dbg!(&tab_line);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably remove this before merging! Great for debugging, probably not great to fill up user's logs!

@@ -25,6 +25,16 @@ pub enum Key {
Esc,
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]

pub enum Mouse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we detect right-clicks with Terminon? If not, we could just rename LeftClick to Click or something like that. We could probably also change MouseHold to Hold and MouseRelease to Release to reduce redundancy!

Looks great otherwise!

@TheLostLambda TheLostLambda merged commit 0710594 into zellij-org:main Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants