-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Pass mouse info to {on,pre}MouseXXX callbacks #3779
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
Conversation
So that we can pass extra arguments to bufpane callbacks easily, by passing them directly to PluginCB().
Pass *tcell.EventMouse to action callbacks for "mouse actions", i.e. to onMousePress, preMouseDrag and so on, similarly to how we pass it to lua functions bound to mouse events.
Now that we can pass extra args directly to PluginCB(), we can remove PluginCBRune() for simplicity.
|
Thanks for this! I tested and it seems to be working fine. |
| success = a(h, te) | ||
| } | ||
| success = success && h.PluginCB("on"+name) | ||
| success = success && h.PluginCB("on"+name, te) |
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.
We add this now also for BufKeyAction too, right?
Furthermore...is this optional argument really backward compatible? 🤔
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.
We add this now also for
BufKeyActiontoo, right?
Yes, but it is nil in that case.
Furthermore...is this optional argument really backward compatible? 🤔
Non-intuitively yes. You can try it. A lua function is free to receive less arguments than we pass to it, or more arguments than we pass to it.
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.
Ah, ok. Then it is legit. 👍
|
Documentation lacks this new feature. |
Yeah. Uploaded #3799 |
Pass
*tcell.EventMouseto action callbacks for "mouse actions", i.e. toonMousePress,preMouseDragand so on, similarly to how we pass it to lua functions bound to mouse events.