aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/aerc.conf4
-rw-r--r--config/ui.go12
-rw-r--r--doc/aerc-config.5.scd4
-rw-r--r--lib/ui/textinput.go4
4 files changed, 23 insertions, 1 deletions
diff --git a/config/aerc.conf b/config/aerc.conf
index d8142197..0dfab7fc 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -241,6 +241,10 @@
# The minimum required characters to allow auto-completion to be triggered after
# completion-delay.
#
+# Setting this to "manual" disables automatic completion, leaving only the
+# manually triggered completion with the $complete key (see aerc-binds(5) for
+# more details).
+#
# Default: 1
#completion-min-chars=1
diff --git a/config/ui.go b/config/ui.go
index 3b637278..17f2339f 100644
--- a/config/ui.go
+++ b/config/ui.go
@@ -3,6 +3,7 @@ package config
import (
"bytes"
"fmt"
+ "math"
"path"
"regexp"
"strconv"
@@ -66,7 +67,7 @@ type UIConfig struct {
Sort []string `ini:"sort" delim:" "`
NextMessageOnDelete bool `ini:"next-message-on-delete" default:"true"`
CompletionDelay time.Duration `ini:"completion-delay" default:"250ms"`
- CompletionMinChars int `ini:"completion-min-chars" default:"1"`
+ CompletionMinChars int `ini:"completion-min-chars" default:"1" parse:"ParseCompletionMinChars"`
CompletionPopovers bool `ini:"completion-popovers" default:"true"`
StyleSetDirs []string `ini:"stylesets-dirs" delim:":"`
StyleSetName string `ini:"styleset-name" default:"default"`
@@ -317,6 +318,15 @@ func (*UIConfig) ParseIndexColumns(section *ini.Section, key *ini.Key) ([]*Colum
return ParseColumnDefs(key, section)
}
+const MANUAL_COMPLETE = math.MaxInt
+
+func (*UIConfig) ParseCompletionMinChars(section *ini.Section, key *ini.Key) (int, error) {
+ if key.String() == "manual" {
+ return MANUAL_COMPLETE, nil
+ }
+ return key.Int()
+}
+
var indexFmtRegexp = regexp.MustCompile(`%(-?\d+)?(\.\d+)?([ACDFRTZadfgilnrstuv])`)
func convertIndexFormat(indexFormat string) ([]*ColumnDef, error) {
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 34bfb882..ef35fd12 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -283,6 +283,10 @@ These options are configured in the *[ui]* section of _aerc.conf_.
The minimum required characters to allow auto-completion to be triggered
after *completion-delay*.
+ Setting this to _manual_ disables automatic completion, leaving only the
+ manually triggered completion with the *$complete* key (see
+ *aerc-binds*(5) for more details).
+
Default: _1_
*border-char-vertical* = _"<char>"_++
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index 4b051d88..d1d46045 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -308,6 +308,10 @@ func (ti *TextInput) updateCompletions() {
// no completer
return
}
+ if ti.completeMinChars == config.MANUAL_COMPLETE {
+ // only manually triggered completion
+ return
+ }
if ti.completeDebouncer == nil {
ti.completeDebouncer = time.AfterFunc(ti.completeDelay, func() {
defer log.PanicHandler()