-
-
Notifications
You must be signed in to change notification settings - Fork 657
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
Mouse AnyEvent tracking (1003) -- work in progress #3538
base: main
Are you sure you want to change the base?
Conversation
You can see my TODOs on top. I will try to minimize commits to this PR so it doesn't constantly spin up the tests. Initial questions:
|
Hey @AutumnMeowMeow ! The direction looks very good. We do not enforce clippy anywhere, so all good.
Sounds perfect. From my side, as long as the plugin API (and especially the protobuf layer) doesn't change we're not breaking anything, so should be good. It sounds like this structure is much more in-tune with the way these events are encoded as seen in your changes, so let's go with it.
Sounds good to me! Note that when you get to serializing these actions to protobuffs, you can just ignore them as unsupported actions here: https://github.com/zellij-org/zellij/blob/main/zellij-utils/src/plugin_api/action.rs#L1295 I'm excited about this feature! Already thinking of how to use it in the UI. |
zellij-utils/src/input/mouse.rs
Outdated
// unfortunate side effect of the pre-SGR-encoded X10 mouse | ||
// protocol design in which release events don't carry | ||
// information about WHICH button(s) were released, so we have | ||
// to maintain a wee bit of state in between events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, even this is much better than what we've been doing up until now with the HeldMouse stuff.
side terminal(s) in, including protobuf. Removed "held" mouse actions. Currently commented out calls to left/middle/right-click/release -- need to fix this though, as selection/copy-paste are broken too. cargo build/test/run works OK. cargo xtask build/test/run fails, unable to find crate input::mouse.
@imsnif OK most of the core new function is here. :) Some things are broken though, and I could use your pointers. (Also converted this to draft in the futile hope it would not spin up the whole CI stuff on every commit...sigh.)
Thank you for your help! :-) |
zellij-server/src/panes/grid.rs
Outdated
self.mouse_buttons_value_sgr(event), | ||
// AZL: Why is event.position not staying 0-based on | ||
// both axes? | ||
event.position.column(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that I missed the relative coordinate conversion in handle_mouse_event(). I'll fix that.
} | ||
Ok(false) // we shouldn't even get here, but might as well not needlessly render if we do | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The three functions above are decently large. Is there logic anywhere else to handle changing the selection buffer size as the mouse is dragged around? If not, then we will need to put that in handle_mouse_event().
pub shift: bool, | ||
pub alt: bool, | ||
pub ctrl: bool, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also FYI that Swing and WIN32 both expose keyboard modifiers with mouse events. Soooo when zellij is running natively on Windows we'll have the infrastructure to do things like Ctrl-Click / Alt-Drag / etc. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, even Alt
+ mouse_click
would be amazing. I'm thinking of using it for multiple selection of panes.
Hey @AutumnMeowMeow - sorry for the delay in getting to this - I'd like to give this a priority but I had a bit of a hectic day yesterday.
Brief explanation: this is happening because the Suggested solution: I think the cleanest way to get around this is to remove the fn termwiz_mouse_convert(original_event: &mut MouseEvent, event: &termwiz::input::MouseEvent)
fn from_termwiz(old_event: &mut MouseEvent, event: termwiz::input::MouseEvent) -> MouseEvent And then place them in the
I think we should be able to use these functions as is (maybe even removing the whole
I think you found this in your other comment, right? |
Refactoring termwiz_mouse_convert and from_termwiz got the builds A few more glitchy things fixed, and now viola, actual proof of concept: simplescreenrecorder-2024-08-29_15.46.26.mp4 |
Very cool @AutumnMeowMeow !! Just a heads up: I'll be on vacation the next two weeks. Will be sure to answer any questions that come up when I get back. |
PR for more detailed discussion, for #1679
Current bit compiles, passes tests, fails clippy (not my fault, other parts of zellij-utils doing that).
Things to do: