fix(tcell_driver): deliver MouseRight and MouseMiddle click events#104
Open
matsest wants to merge 1 commit intojesseduffield:masterfrom
Open
fix(tcell_driver): deliver MouseRight and MouseMiddle click events#104matsest wants to merge 1 commit intojesseduffield:masterfrom
matsest wants to merge 1 commit intojesseduffield:masterfrom
Conversation
Set dragState on press and reset it on release for secondary and middle mouse buttons, matching the existing behavior for primary button. Previously these events were silently discarded because dragState was never set, causing the event loop to always hit NOT_DRAGGING case and return eventNone.
Author
|
First, thanks for maintaining this excellent fork, and the awesome lazygit and lazydocker! Found this when I tried implementing use of MouseRight and MouseMiddle in an application I built that uses this gocui-implementation, and couldn't get any of them to work. This fix made gocui pick up the mouse clicks successfully, when testing a local version of this package. I don't know if you accept contributions regarding other usage than lazygit/lazydocker, so fully understand if that is the case. Just didn't want to maintain a fork for such a small patch, when this is already there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
In
tcell_driver.go, the event loop tracks mouse drag state.When a mouse button is pressed,
dragStateshould be set toMAYBE_DRAGGINGso the click event is sent. On release, it should be reset toNOT_DRAGGING.The bug: Only
MouseLeft(ButtonPrimary) setsdragStateon press and resets it on release.Later, when checking if the event should be delivered:
Since
dragStatewas never set forMouseRightorMouseMiddle, it remainsNOT_DRAGGING, causing the event to be discarded before delivery.Fix
Set dragState on press and reset it on release for secondary and middle mouse buttons, matching the existing behavior for primary button. Previously these events were silently discarded because dragState was never set, causing the event loop to always hit NOT_DRAGGING case and return eventNone.