Skip to content

Conversation

@dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Jun 21, 2025

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.

dmaluka added 3 commits June 21, 2025 03:04
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.
@cutelisp
Copy link
Contributor

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)
Copy link
Collaborator

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? 🤔

Copy link
Collaborator Author

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?

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.

Copy link
Collaborator

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. 👍

@dmaluka dmaluka merged commit 41b912b into zyedidia:master Jun 29, 2025
6 checks passed
@cutelisp
Copy link
Contributor

Documentation lacks this new feature.

@dmaluka
Copy link
Collaborator Author

dmaluka commented Jul 5, 2025

Documentation lacks this new feature.

Yeah. Uploaded #3799

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