From 055c6dc6604f7f5ae7de060a36c81dc77801dca3 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Wed, 28 Sep 2022 13:17:21 -0500 Subject: exline: don't draw completions for keybinds The exline widget works by matching actual keystrokes to a map of keybinds, and if a match is found sending simulated keystrokes through aerc. This has the effect of aerc thinking we are actually typing in the expanded command, and aerc attempts to draw the completions. This results in even basic navigation having two screen draws: For example, pressing 'j' to select the next message (:next), draws once for the initial key event and state change, and again after the completion debounce timer. Disable tab completion while aerc is simulating keystrokes. If the exline still has focus after simulating keystrokes, restore tab completion. Signed-off-by: Tim Culverhouse Acked-by: Koni Marti --- widgets/exline.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'widgets/exline.go') diff --git a/widgets/exline.go b/widgets/exline.go index d43bdecb..8d3c7ca6 100644 --- a/widgets/exline.go +++ b/widgets/exline.go @@ -40,6 +40,10 @@ func NewExLine(conf *config.AercConfig, cmd string, commit func(cmd string), fin return exline } +func (x *ExLine) TabComplete(tabComplete func(string) ([]string, string)) { + x.input.TabComplete(tabComplete, x.conf.Ui.CompletionDelay) +} + func NewPrompt(conf *config.AercConfig, prompt string, commit func(text string), tabcomplete func(cmd string) ([]string, string), ) *ExLine { -- cgit