aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/exline.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-11-01 12:37:16 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-06 23:16:08 +0100
commit6b0b5596dee5dda9fb367cbf8c82e52b9e6125a3 (patch)
tree9aeabf8ce24009bbdf28829647827951f21e425e /widgets/exline.go
parent14ceca320065656ea31994191f9e74d254a72e04 (diff)
downloadaerc-6b0b5596dee5dda9fb367cbf8c82e52b9e6125a3.tar.gz
auto-completion: add option to require a min number of chars
When doing address completion via commands that take a while to run, having the completion trigger even with a single character can be non-optimal. Add an option to allow requiring a minimum number of characters to actually run the completion command. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/exline.go')
-rw-r--r--widgets/exline.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/widgets/exline.go b/widgets/exline.go
index 789ccde8..5cf4338d 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -23,7 +23,11 @@ func NewExLine(conf *config.AercConfig, cmd string, commit func(cmd string), fin
) *ExLine {
input := ui.NewTextInput("", &conf.Ui).Prompt(":").Set(cmd)
if conf.Ui.CompletionPopovers {
- input.TabComplete(tabcomplete, conf.Ui.CompletionDelay)
+ input.TabComplete(
+ tabcomplete,
+ conf.Ui.CompletionDelay,
+ conf.Ui.CompletionMinChars,
+ )
}
exline := &ExLine{
commit: commit,
@@ -37,7 +41,11 @@ func NewExLine(conf *config.AercConfig, cmd string, commit func(cmd string), fin
}
func (x *ExLine) TabComplete(tabComplete func(string) ([]string, string)) {
- x.input.TabComplete(tabComplete, x.conf.Ui.CompletionDelay)
+ x.input.TabComplete(
+ tabComplete,
+ x.conf.Ui.CompletionDelay,
+ x.conf.Ui.CompletionMinChars,
+ )
}
func NewPrompt(conf *config.AercConfig, prompt string, commit func(text string),
@@ -45,7 +53,11 @@ func NewPrompt(conf *config.AercConfig, prompt string, commit func(text string),
) *ExLine {
input := ui.NewTextInput("", &conf.Ui).Prompt(prompt)
if conf.Ui.CompletionPopovers {
- input.TabComplete(tabcomplete, conf.Ui.CompletionDelay)
+ input.TabComplete(
+ tabcomplete,
+ conf.Ui.CompletionDelay,
+ conf.Ui.CompletionMinChars,
+ )
}
exline := &ExLine{
commit: commit,