aboutsummaryrefslogtreecommitdiffstats
path: root/commands/completion_helpers.go
Commit message (Collapse)AuthorAgeFilesLines
* textinput: make completions run async with cancellationTim Culverhouse27 hours1-1/+2
| | | | | | | | | | | | | | | | | | Make the Completer interface accept a context.Context. Provide a cancellation feature on text input tab completion to cancel an inflight completion command. This is particularly useful for address book completion if the user has specified a network-accessing command, eg carddav-query. The command is started according to the completion delay, but is cancellable if another request comes in. We also check for cancellation after the request is complete to ensure we only show valid completion results. Changelog-changed: Tab completions for text fields are run asynchronously. In-flight requests are cancelled when new input arrives. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* completion: display descriptions next to choicesRobin Jarry3 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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 <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* forward: allow forwarded flag to be setinwit2024-08-201-1/+1
| | | | | | | | | | | | Usually, a MUA sets a flag for messages that have been forwarded, but this is currently not the case for aerc. Consider the forwarded flag and prepare aerc to set it everytime the :forward command is called and ends successfully. Changelog-added: The :forward command now sets the forwarded flag. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* query: add completions for notmuch search-termsBence Ferdinandy2024-04-141-1/+1
| | | | | | | | | | | | | | Add completions to :query for the notmuch search terms. Most search terms that seemed valid for interactive use in aerc are listed as options. Some of them (from, to, tag, path, and folder) get actual completions. The function was designed, so later patches can reuse it to add completions to :cf, :filter and :search for notmuch accounts. References: https://todo.sr.ht/~rjarry/aerc/244 Changelog-added: Notmuch search term completions to `:query`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Julio B <julio.bacel@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* log: move package to libRobin Jarry2024-02-141-1/+1
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* flags: add support for draft flagJason Cox2024-01-261-1/+1
| | | | | | | | | | | | | | Support the draft flag wherever flags are used. Automatically set it when postponing a message, and allow recalling a message without the -f flag if it has the draft flag set, regardless of what folder it's in. Notmuch doesn't seem to pick up on the draft flag when indexing even though the flag is set on the maildir file. Explicitly set all tags corresponding to set flags when appending a message in notmuch. Changelog-added: Support the `draft` flag. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* app: export global functionsRobin Jarry2023-10-101-3/+3
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-101-2/+2
| | | | | | | | | This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* commands: add OptionsProvider and OptionCompleterKoni Marti2023-05-161-0/+78
Improve command completion by supporting option flags and option arguments completion. Option completion is activated when the command implements the OptionsProvider interface. Implementing the OptionCompleter allows the completion of individual option arguments. The completion interfaces harmonizes the completion behavior in aerc, makes the completion code clearer and simplifies the completion functionality. With this patch, the Complete method on commands will only have to deal with the actual completion, i.e. paths, folders, etc and not worry about options. To remove all options and its mandatory arguments from args, use commands.Operands(). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>