Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't think that it is a good idea to export values/definitions from tcell's interface.
Shouldn't we wrap 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.
What do you mean by wrap it, could you give an example?
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.
By exporting the content of
e.Buttons()ande.Modifiers()we implicit export a dependency to the interface oftcell.If this is OK, then we can go that way, but I've some doubts right now.
The plugins should only have a dependency to
micro, but not its dependencies. To solve this we would need to define our own MouseEvent, which we already have (withtcelldependencies too)...So a new
structcould fit the needs and it should include the coordinates, buttons and modifiers. On the other hand this means, that we duplicate this kind of event.@dmaluka:
What is your opinion about 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.
Actually we already export
*tcell.EventMouseto lua in some cases, namely, we pass it to lua functions bound to mouse events (MouseLeft,MouseRight,MouseRightDragetc), since #2605. Yeah, I'm guilty of that. (Also I'm guilty of not documenting that.)So, we may debate whether or not it is/was a good idea to directly expose tcell stuff to lua... But since we are already doing that anyway, I think, at least, that simply passing the entire
*tcell.EventMouseis in all respects better than passing its components as individual arguments....But first of all, I'm not sure we want this new callback in the first place. It seems what we actually want is to pass the mouse info (for example, again, just pass
*tcell.EventMouse) to the already existing callbacks of "mouse actions", i.e. toonMousePress,onMouseDrag,onMouseRelease,onMouseMultiCursor,preMousePress,preMouseDrag,preMouseRelease,preMouseMultiCursor.And that seems easy to implement: #3779
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.
Agree.
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.
#3779 merged, can we close this PR as unneeded?
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.
Absolutely, thanks for your PR.