Skip to content
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

Allow more mouse modifiers and include them on mousewheel events #111

Merged
merged 2 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions keybinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ const (

// Modifiers.
const (
ModNone Modifier = Modifier(0)
ModAlt = Modifier(tcell.ModAlt)
// ModCtrl doesn't work with keyboard keys. Use CtrlKey in Key and ModNone. This is was for mouse clicks only (tcell.v1)
// ModCtrl = Modifier(tcell.ModCtrl)
ModNone Modifier = Modifier(0)
ModAlt = Modifier(tcell.ModAlt)
ModMouseShift = Modifier(tcell.ModShift)
ModMouseCtrl = Modifier(tcell.ModCtrl)
)
4 changes: 4 additions & 0 deletions tcell_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,19 @@ func pollEvent() gocuiEvent {
// process mouse wheel
if button&tcell.WheelUp != 0 {
mouseKey = MouseWheelUp
mouseMod = Modifier(tev.Modifiers())
}
if button&tcell.WheelDown != 0 {
mouseKey = MouseWheelDown
mouseMod = Modifier(tev.Modifiers())
}
if button&tcell.WheelLeft != 0 {
mouseKey = MouseWheelLeft
mouseMod = Modifier(tev.Modifiers())
}
if button&tcell.WheelRight != 0 {
mouseKey = MouseWheelRight
mouseMod = Modifier(tev.Modifiers())
}

// process button events (not wheel events)
Expand Down