From 3c9ad93801ce9bb71d76fa398d7d94f1afd2c2cb Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sat, 12 Oct 2024 00:21:44 +0200 Subject: completion: display descriptions next to choices Use go-opt v2 new completion API which returns items descriptions along with their text values. Display the descriptions after the items separated by two spaces. Wrap the descriptions in parentheses to better indicate that they are not part of the completion choices. Limit the description length to 80 characters to avoid display issues. Add a new style object completion_description in stylesets. By default, the object will be rendered with a dimmed terminal attribute. Update all stylesets and documentation accordingly. Implements: https://todo.sr.ht/~rjarry/aerc/271 Link: https://git.sr.ht/~rjarry/go-opt/commit/ebeb82538395a Changelog-added: Command completion now displays descriptions next to completion items. Changelog-added: New `completion_description` style object in style sets used for rendering completion item descriptions. Signed-off-by: Robin Jarry Tested-by: Bojan Gabric Tested-by: Jason Cox Acked-by: Tim Culverhouse --- app/app.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/app.go') diff --git a/app/app.go b/app/app.go index 37444c8b..071aac74 100644 --- a/app/app.go +++ b/app/app.go @@ -10,6 +10,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rjarry/go-opt/v2" "github.com/ProtonMail/go-crypto/openpgp" ) @@ -18,7 +19,7 @@ var aerc Aerc func Init( crypto crypto.Provider, cmd func(string, *config.AccountConfig, *models.MessageInfo) error, - complete func(cmd string) ([]string, string), history lib.History, + complete func(cmd string) ([]opt.Completion, string), history lib.History, deferLoop chan struct{}, ) { aerc.Init(crypto, cmd, complete, history, deferLoop) -- cgit