diff options
-rw-r--r-- | app/aerc.go | 17 | ||||
-rw-r--r-- | doc/aerc-binds.5.scd | 8 |
2 files changed, 21 insertions, 4 deletions
diff --git a/app/aerc.go b/app/aerc.go index 31d3a44b..ee383f86 100644 --- a/app/aerc.go +++ b/app/aerc.go @@ -274,20 +274,29 @@ func (aerc *Aerc) getBindings() *config.KeyBindings { func (aerc *Aerc) simulate(strokes []config.KeyStroke) { aerc.pendingKeys = []config.KeyStroke{} + bindings := aerc.getBindings() + complete := aerc.SelectedAccountUiConfig().CompletionMinChars != config.MANUAL_COMPLETE aerc.simulating += 1 + for _, stroke := range strokes { simulated := tcell.NewEventKey( - stroke.Key, stroke.Rune, tcell.ModNone) + stroke.Key, stroke.Rune, stroke.Modifiers) aerc.Event(simulated) + complete = stroke == bindings.CompleteKey } aerc.simulating -= 1 - // If we are still focused on the exline, turn on tab complete if exline, ok := aerc.focused.(*ExLine); ok { + // we are still focused on the exline, turn on tab complete exline.TabComplete(func(cmd string) ([]string, string) { return aerc.complete(cmd) }) - // send tab to text input to trigger completion - exline.Event(tcell.NewEventKey(tcell.KeyTab, 0, tcell.ModNone)) + if complete { + // force completion now + exline.Event(tcell.NewEventKey( + bindings.CompleteKey.Key, + bindings.CompleteKey.Rune, + bindings.CompleteKey.Modifiers)) + } } } diff --git a/doc/aerc-binds.5.scd b/doc/aerc-binds.5.scd index b00c12d8..6bb2100e 100644 --- a/doc/aerc-binds.5.scd +++ b/doc/aerc-binds.5.scd @@ -129,6 +129,14 @@ available in each binding context: Default: _<tab>_ + Note: automatic command completion is disabled when simulating + keystrokes and re-enabled at the end. When *[ui].completion-min-chars* + is set to _manual_ (see *aerc-config*(5)), it is possible to end + a keybinding with the completion key to explicitly display the + completion menu. E.g.: + + *o* = _:cf<space><tab>_ + # SUPPORTED KEYS In addition to letters and some characters (e.g. *a*, *RR*, *gu*, *?*, *!*, |