Use : for keybindings even when ex is overridden

This commit is contained in:
Drew DeVault 2019-03-21 17:49:59 -04:00
parent 6d01332b55
commit 699f1cf7a6

View file

@ -18,6 +18,7 @@ type Aerc struct {
focused libui.Interactive focused libui.Interactive
grid *libui.Grid grid *libui.Grid
logger *log.Logger logger *log.Logger
simulating int
statusbar *libui.Stack statusbar *libui.Stack
statusline *StatusLine statusline *StatusLine
pendingKeys []config.KeyStroke pendingKeys []config.KeyStroke
@ -107,11 +108,13 @@ func (aerc *Aerc) getBindings() *config.KeyBindings {
func (aerc *Aerc) simulate(strokes []config.KeyStroke) { func (aerc *Aerc) simulate(strokes []config.KeyStroke) {
aerc.pendingKeys = []config.KeyStroke{} aerc.pendingKeys = []config.KeyStroke{}
aerc.simulating += 1
for _, stroke := range strokes { for _, stroke := range strokes {
simulated := tcell.NewEventKey( simulated := tcell.NewEventKey(
stroke.Key, stroke.Rune, tcell.ModNone) stroke.Key, stroke.Rune, tcell.ModNone)
aerc.Event(simulated) aerc.Event(simulated)
} }
aerc.simulating -= 1
} }
func (aerc *Aerc) Event(event tcell.Event) bool { func (aerc *Aerc) Event(event tcell.Event) bool {
@ -150,9 +153,12 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
} }
if !incomplete { if !incomplete {
aerc.pendingKeys = []config.KeyStroke{} aerc.pendingKeys = []config.KeyStroke{}
if event.Key() == bindings.ExKey.Key && exKey := bindings.ExKey
event.Rune() == bindings.ExKey.Rune { if aerc.simulating > 0 {
// Keybindings still use : even if you change the ex key
exKey = aerc.conf.Bindings.Global.ExKey
}
if event.Key() == exKey.Key && event.Rune() == exKey.Rune {
aerc.BeginExCommand() aerc.BeginExCommand()
return true return true
} }