parent
af988284a4
commit
a13c14fb07
@ -21,6 +21,7 @@ func run() {
|
||||
} else if err = screen.Init(); err != nil {
|
||||
log.Fatalf("initializing screen: %s", err)
|
||||
}
|
||||
screen.EnableMouse()
|
||||
|
||||
f, err := os.Create(gLogPath)
|
||||
if err != nil {
|
||||
|
18
doc.go
18
doc.go
@ -835,6 +835,24 @@ On these terminals, keys combined with the alt key are prefixed with 'a' charact
|
||||
Please note that, some key combinations are not possible due to the way terminals work (e.g. control and h combination sends a backspace key instead).
|
||||
The easiest way to find the name of a key combination is to press the key while lf is running and read the name of the key from the unknown mapping error.
|
||||
|
||||
Mouse buttons are prefixed with 'm' character:
|
||||
|
||||
map <m-1> down # primary
|
||||
map <m-2> down # secondary
|
||||
map <m-3> down # middle
|
||||
map <m-4> down
|
||||
map <m-5> down
|
||||
map <m-6> down
|
||||
map <m-7> down
|
||||
map <m-8> down
|
||||
|
||||
Mouse wheel events are also prefixed with 'm' character:
|
||||
|
||||
map <m-up> down
|
||||
map <m-down> down
|
||||
map <m-left> down
|
||||
map <m-right> down
|
||||
|
||||
Push Mappings
|
||||
|
||||
The usual way to map a key sequence is to assign it to a named or unnamed command.
|
||||
|
18
docstring.go
18
docstring.go
@ -909,6 +909,24 @@ instead). The easiest way to find the name of a key combination is to press
|
||||
the key while lf is running and read the name of the key from the unknown
|
||||
mapping error.
|
||||
|
||||
Mouse buttons are prefixed with 'm' character:
|
||||
|
||||
map <m-1> down # primary
|
||||
map <m-2> down # secondary
|
||||
map <m-3> down # middle
|
||||
map <m-4> down
|
||||
map <m-5> down
|
||||
map <m-6> down
|
||||
map <m-7> down
|
||||
map <m-8> down
|
||||
|
||||
Mouse wheel events are also prefixed with 'm' character:
|
||||
|
||||
map <m-up> down
|
||||
map <m-down> down
|
||||
map <m-left> down
|
||||
map <m-right> down
|
||||
|
||||
|
||||
Push Mappings
|
||||
|
||||
|
22
lf.1
22
lf.1
@ -1004,6 +1004,28 @@ Newer terminals (e.g. gnome-terminal) may prefix the key with an escape key when
|
||||
.EE
|
||||
.PP
|
||||
Please note that, some key combinations are not possible due to the way terminals work (e.g. control and h combination sends a backspace key instead). The easiest way to find the name of a key combination is to press the key while lf is running and read the name of the key from the unknown mapping error.
|
||||
.PP
|
||||
Mouse buttons are prefixed with 'm' character:
|
||||
.PP
|
||||
.EX
|
||||
map <m-1> down # primary
|
||||
map <m-2> down # secondary
|
||||
map <m-3> down # middle
|
||||
map <m-4> down
|
||||
map <m-5> down
|
||||
map <m-6> down
|
||||
map <m-7> down
|
||||
map <m-8> down
|
||||
.EE
|
||||
.PP
|
||||
Mouse wheel events are also prefixed with 'm' character:
|
||||
.PP
|
||||
.EX
|
||||
map <m-up> down
|
||||
map <m-down> down
|
||||
map <m-left> down
|
||||
map <m-right> down
|
||||
.EE
|
||||
.SH PUSH MAPPINGS
|
||||
The usual way to map a key sequence is to assign it to a named or unnamed command. While this provides a clean way to remap builtin keys as well as other commands, it can be limiting at times. For this reason 'push' command is provided by lf. This command is used to simulate key pushes given as its arguments. You can 'map' a key to a 'push' command with an argument to create various keybindings.
|
||||
.PP
|
||||
|
39
ui.go
39
ui.go
@ -1018,6 +1018,44 @@ func (ui *ui) readNormalEvent(ev tcell.Event) expr {
|
||||
ui.menuBuf = listBinds(binds)
|
||||
return draw
|
||||
}
|
||||
case *tcell.EventMouse:
|
||||
var button string
|
||||
|
||||
switch tev.Buttons() {
|
||||
case tcell.Button1:
|
||||
button = "<m-1>"
|
||||
case tcell.Button2:
|
||||
button = "<m-2>"
|
||||
case tcell.Button3:
|
||||
button = "<m-3>"
|
||||
case tcell.Button4:
|
||||
button = "<m-4>"
|
||||
case tcell.Button5:
|
||||
button = "<m-5>"
|
||||
case tcell.Button6:
|
||||
button = "<m-6>"
|
||||
case tcell.Button7:
|
||||
button = "<m-7>"
|
||||
case tcell.Button8:
|
||||
button = "<m-8>"
|
||||
case tcell.WheelUp:
|
||||
button = "<m-up>"
|
||||
case tcell.WheelDown:
|
||||
button = "<m-down>"
|
||||
case tcell.WheelLeft:
|
||||
button = "<m-left>"
|
||||
case tcell.WheelRight:
|
||||
button = "<m-right>"
|
||||
case tcell.ButtonNone:
|
||||
return nil
|
||||
}
|
||||
|
||||
expr, ok := gOpts.keys[button]
|
||||
if ok {
|
||||
return expr
|
||||
}
|
||||
|
||||
return nil
|
||||
case *tcell.EventResize:
|
||||
return &callExpr{"redraw", nil, 1}
|
||||
case *tcell.EventError:
|
||||
@ -1084,6 +1122,7 @@ func (ui *ui) resume() {
|
||||
} else if err = screen.Init(); err != nil {
|
||||
log.Fatalf("initializing screen: %s", err)
|
||||
}
|
||||
screen.EnableMouse()
|
||||
|
||||
ui.screen = screen
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user