Bind Ctrl+MouseWheel to scroll up/down (#1051)
On my system, Shift+Mouse is captured by the terminal and
Alt+Mouse only works for one of the alt keys. Hence I picked
Ctrl.
This also allows binding of Ctrl+MouseButtons (but doesn't set
any such bindings).
As a minor bonus, that should allow using Ctrl+Click to select
`lf`'s terminal without moving the cursor no matter where you
click. On tmux, this doesn't work out of the box and requires
a change to `tmux.conf` along the following lines:
bind-key -T root C-MouseDown1Pane select-pane -t = \; send-keys -M
You can omit the `send-keys -M` if you never want to pass
`Ctrl+Click` to any of your terminal apps. (Then it will work
without this PR).
This commit is contained in:
1 parent
a4fa5d36c9
commit
2fe5e4d54e
5 files changed
+14
-6
No files matched your search
@@ -1182,12 +1182,18 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
|
||||
case tcell.ButtonNone:
|
||||
return nil
|
||||
}
|
||||
if tev.Modifiers() == tcell.ModCtrl {
|
||||
button = "<c-" + button[1:]
|
||||
}
|
||||
if expr, ok := gOpts.keys[button]; ok {
|
||||
return expr
|
||||
}
|
||||
|
||||
if tev.Buttons() != tcell.Button1 && tev.Buttons() != tcell.Button2 {
|
||||
return nil
|
||||
if button != "<m-1>" && button != "<m-2>" {
|
||||
ui.echoerrf("unknown mapping: %s", button)
|
||||
ui.keyAcc = nil
|
||||
ui.keyCount = nil
|
||||
ui.menuBuf = nil
|
||||
return draw
|
||||
}
|
||||
|
||||
x, y := tev.Position()
|
||||
|
||||
Reference in new issue
Block a user