mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Add ability to bind alt keys
This lets you bind keys like Alt-b or Alt-f. This commit also adds some new default keybindings in emacs style, so alt-a is beginning of line and alt-e is end etc...
This commit is contained in:
@@ -253,7 +253,7 @@ func (v *View) HandleEvent(event tcell.Event) {
|
||||
// Window resized
|
||||
v.Resize(e.Size())
|
||||
case *tcell.EventKey:
|
||||
if e.Key() == tcell.KeyRune {
|
||||
if e.Key() == tcell.KeyRune && e.Modifiers() == 0 {
|
||||
// Insert a character
|
||||
if v.Cursor.HasSelection() {
|
||||
v.Cursor.DeleteSelection()
|
||||
@@ -264,6 +264,11 @@ func (v *View) HandleEvent(event tcell.Event) {
|
||||
} else {
|
||||
for key, action := range bindings {
|
||||
if e.Key() == key.keyCode {
|
||||
if e.Key() == tcell.KeyRune {
|
||||
if e.Rune() != key.r {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if e.Modifiers() == key.modifiers {
|
||||
relocate = action(v)
|
||||
for _, pl := range loadedPlugins {
|
||||
|
||||
Reference in New Issue
Block a user