aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-10-31wiprustRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-31wipRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-31wipRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-30msgviewer: implement inline image viewingTim Culverhouse
Implement inline image viewing for jpeg, png, bmp, tiff, and webp formats. When a user has no configured image filter and the image is supported and the terminal has either sixel or kitty image protocol support, the image will be displayed in the message viewer. Always clear the screen before each draw. This call is necessary in vaxis to allow for images to be cleared properly between renders. There is no performance impact: the call only resets each cell to a blank cell, and aerc will redraw each one already. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-30ui: create and expose vaxis Window with ContextTim Culverhouse
Create and expose a vaxis.Window object with each Context. vaxis.Windows are used for creating local coordinates (similar to the views.View API that tcell provides). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-30ui: so long tcellTim Culverhouse
Replace tcell with vaxis. Vaxis provides several new features (none of which are included in this commit). All behavior should be exactly the same as previous, with one exception: Vaxis does not have an internal terminfo library. Some terminals will now have RGB that didn't before, as well as any other feature that was falling back to some unknown state. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-30parse/ansi: remove tcell/terminfo dependencyTim Culverhouse
The parse library builds an ansi-escaped string based on a buffer of styled cells. Use constants which aerc will still parse properly (and are the same as the terminfo package was pulling in) to remove dependency on tcell/terminfo. Additionally, we can use the internal go "fmt" package to write strings instead of the terminfo.TParm method (which is much slower at formatting strings). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-30viewer: parts tableRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-30linters: avoid crash when analyzing function callRobin Jarry
When encountering a statement such as: go functionName() The identifier is not a local symbol but should be looked up in the current package. Do not consider that all these statements will refer to local variables. The only way to do this is to run a second analyzer that depends on the first one. Store all unresolved methods and functions into a indirectCalls struct. Reuse that result in the second analyzer to resolve the function declarations and check their bodies for the defer log.PanicHandler() statement. Fix one newly reported issues. Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-30complete: allow disabling automatic completionRobin Jarry
Allow setting complete-min-chars = 0 to disable automatic completion. By default, the available completion choices can be displayed with <tab> or <c-o> when in the composer. These keys may be configured using the special $complete entry in binds.conf. Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-30cf: do not quote notmuch queries in completion resultsRobin Jarry
Notmuch queries should not be quoted, they will be interpreted by the notmuch library. Make sure not to return quoted results for directories which have the role == "query". Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-30completion: refactor filter list apiRobin Jarry
Remove CompletionFromList which is a trivial wrapper around FilterList. Remove the prefix, suffix and isFuzzy arguments from FilterList. Replace prefix, suffix by an optional callback to allow post processing of completion results before presenting them to the user. Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-30cf: fix unexpected argument on notmuchRobin Jarry
Notmuch supports creating "dynamic" folders with the :cf command. When the backend is notmuch, :cf must accept multiple arguments since it can be a free-form notmuch query. Detect if the backend is notmuch and build a quoted query based on the provided arguments. Otherwise require a single argument. Fixes: e54486ee40c9 ("commands: parse arguments with go-opt") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
2023-10-30complete: add trailing space after quotesRobin Jarry
Currently, completing `:tag +forw` gives: '+forwarded ' instead of simply +forwarded without quotes with an embedded trailing space. Add the suffix *after* quoting. Fixes: abe228b14d97 ("commands: use completion from go-opt") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28treewide: replace shlex.Split with opt.SplitArgsRobin Jarry
Replace the remaining shlex.Split calls with opt.SplitArgs. Remove dependency to shlex. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28commands: use completion from go-optRobin Jarry
Implement command completion with complete struct field tags from the get-opt library introduced earlier. Changelog-changed: Improved command completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28commands: remove command set completion apiRobin Jarry
Do not expose the completion of a command via its command set. Instead, require a single command object to be resolved in order to execute it. Extract the command names and the template terms completions in main.go. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28pipe: run commands with sh -cRobin Jarry
Change the Cmd argument to a plain string that preserves shell quoting. Use this for sh -c instead of a list of arguments. Changelog-changed: `:pipe` commands are now executed with `sh -c`. Requested-by: Vitaly Ovchinnikov <v@postbox.nz> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28open: run commands with sh -cRobin Jarry
Allow running shell commands in openers. Changelog-changed: `:open` commands are now executed with `sh -c`. Requested-by: Vitaly Ovchinnikov <v@postbox.nz> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28search: use a common api for all workersRobin Jarry
Define a SearchCriteria structure. Update the FetchDirectoryContents, FetchDirectoryThreaded and SearchDirectory worker messages to include this SearchCriteria structure instead of a []string slice. Parse the search arguments in a single place into a SearchCriteria structure and use it to search/filter via the message store. Update all workers to use that new API. Clarify the man page indicating that notmuch supports searching with aerc's syntax and also with notmuch specific syntax. getopt is no longer needed, remove it from go.mod. NB: to support more complex search filters in JMAP, we need to use an email.Filter interface. Since GOB does not support encoding/decoding interfaces, store the raw SearchCriteria and []SortCriterion values in the cached FolderContents. Translate them to JMAP API objects when sending an email.Query request to the server. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28worker: move shared code to libRobin Jarry
Avoid importing code from worker/lib into lib. It should only be the other way around. Move the message parsing code used by maildir, notmuch, mbox and the eml viewer into a lib/rfc822 package. Adapt imports accordingly. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28main: parse command line args with go-optRobin Jarry
Use get-opt to make argument parsing more explicit and have automatic usage generation. Update the man page to include missing details. Add a -h flag to display verbose usage and descriptions of options. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28commands: parse arguments with go-optRobin Jarry
Use the argument parsing framework introduced earlier to unify the parsing of (almost) all command options. Remove custom parsing code and to avoid extraneous types, add fields with `opt` tags on command structs that have options and arguments. Commands that take no argument do not need anything. Since the command objects now carry data, create a new temporary instance of them before passing them to opt.ArgsToStruct when executing a command. A few of the commands use specific semantics for parsing (:choose), or are delegating argument parsing to another function (:sort, :search, :filter). For these commands, simply add a dummy "-" passthrough argument. Since all commands still have the argument list (after split) nothing needs to be changed in this area. There should be no functional change besides the Usage strings and reported errors which are now generated automatically. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28commands: remove command set execute apiRobin Jarry
Do not expose the execution of a command via its command set. Instead, require a single command object to be resolved in order to execute it. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28commands: expand templates before command resolutionRobin Jarry
Move the template expansion before the command name is looked up. It saves a few void renderings and will be required for the next commits. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28commands: pass raw command line down to template evaluationRobin Jarry
Some commands need to invoke others and/or run shell commands. For this, we need the raw command line as entered by the user. Pass it down the call chain just before it is split to invoke the command Execute method. Remove unit tests for the template expand() test which does have any added value now that it is performed on a single string without any quote juggling. Update all code to handle a single string instead of a list of arguments. Introduce a new dependency on git.sr.ht/~rjarry/go-opt to deal with shell splitting. This is in preparation for using opt.ArgsToStruct to parse arguments for all aerc commands. There should be no functional change after this patch. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-28lib: remove unused ShellQuote functionRobin Jarry
This function is not used anywhere. Remove it. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
2023-10-26compose: fix crash when getting hostnameMoritz Poldrack
Currently we assume that a From: address is present when retrieving the hostname for the message ID. This results in an index-out-of-range error when no From address is present. Generate a random hostname for the message ID, if no From: address is present. Fixes: 608bc4fa7fa7 ("compose: use email domain name in Message-Id") Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-26aerc: initialise the random number generatorMoritz Poldrack
Add an init function to the main package that seeds the RNG with based on the current time. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-25compose: fix header navigation after :compose -eRobin Jarry
When the terminal is closed with [compose].edit-headers=true, all headers are deleted and recreated based on the email content. Since the terminal is not active, adding the first header was working fine, but the next ones were replacing the single entry on each call of addEditor(). Fix the broken append() logic. Reported-by: Inwit <inwit@sindominio.net> Fixes: c2a4fc7fdfae ("compose: avoid panic when deleting the last header") Changelog-fixed: Selection of headers in composer after `:compose -e` followed by `:edit -E`. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
2023-10-24commands: add :suspendNojus Gudinavičius
Add :suspend to suspend the aerc process, returning to shell. Include documentation and default Ctrl-z keybinding for it. Changelog-added: New `:suspend` command bound to `<C-z>` by default. Signed-off-by: Nojus Gudinavičius <nojus.gudinavicius@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-23changelog: get unreleased entries from commit trailersRobin Jarry
Asking contributors to update the CHANGELOG.md file is causing lots of merge conflicts. Introduce a new workflow where contributors can attach changelog entries in patches via git trailers. Changelog-added: For new features. Changelog-fixed: For bug fixes. Changelog-changed: For behaviour or config format changes. Changelog-deprecated: For deprecation or removal of functionality. If a complete trailer is longer than 72 characters, it can be continued by indenting extra lines with a single space. The trailer text must be valid markdown. Update CONTRIBUTING.md with new guidelines. Update contrib/release.sh to extract these trailers before tagging and create a new section in CHANGELOG.md. Extract unreleased entries in this commit to follow the new workflow. Changelog-added: New `flagged` criteria for `:sort`. Changelog-added: New `:send-keys` command to control embedded terminals. Changelog-added: Account aliases now support fnmatch-style wildcards. Changelog-fixed: `colorize` support for wildcards `?` and `*`. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2023-10-22export-mbox: preserve the user-visible sorting order when exportingVitaly Ovchinnikov
Export messages to mbox format in the same order as they are displayed to the user. Both marked-only and "full" export modes are supported. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-22accounts: allow fnmatch-style wildcards in aliasesJason Cox
Wildcard aliases make it possible to always reply from the same address to which a message was addressed, which is useful for catch-all email domains. Support fnmatch-style wildcards in only the address portion of an alias. When replying to a message that matches a wildcard alias, substitute the matching email address for the wildcard address, but keep the name specified with the wildcard address. For example, when the alias "Someone Awesome" <*@someone.com> is present, the reply to an email addressed to "Someone" <hi@someone.com> would be from "Someone Awesome" <hi@someone.com>. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-22config: ensure account order as requestedKoni Marti
Ensure the account order as requested by the -a option on the command line. The current sorting is not working correctly, since it sorts Accounts []*AccountConfig by comparing the names instead of the indexes of the requested accounts. Fixes: https://todo.sr.ht/~rjarry/aerc/190 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-22contrib: add a script to generate release statisticsBence Ferdinandy
Add a new python script, that will generate two types of statistics for each minor release (and HEAD) from the local repository and create a graph. First statistics is number of commits since the previous release, the second statistics is number of lines inserted and deleted since the previous release. The placement of the text annotations (tag names) is mildly smart, so the distribution changes significantly the hard coded numbers might have to be tweaked. Requires matplotlib to be installed (developed with 3.7.3). It generates a png by default, but this can be changed by passing the output file option with a different file extension as long as matplotlib knows what to do with it. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-22terminal: add `:send-keys` commandVitaly Ovchinnikov
Add a new command for sending keystrokes to the active terminal, if there is one visible. Covers split preview, message viewer, composer and the terminal mode. This can be used to navigate the embedded applications to scroll or safely quit them when needed. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-21release.sh: fix typoRobin Jarry
It is GNUmakefile, not GNUMakefile. Fixes: d179485eefe5 ("release.sh: update version in GNUMakefile") Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-10-13notmuch: return all siblings in threadsinwit
Notmuch threads can silently drop sibling messages during threading when a thread has multiple "top level messages" (IE a thread where the root is missing). Modify makeThread to return a slice of all encountered siblings and add these as individual threads. Note that the current implementation does not link these threads together with a dummy parent node. This should be done in the future when rendering of these types of threads is implemented Fixes: https://todo.sr.ht/~rjarry/aerc/188 Reported-by: inwit <inwit@sindominio.net> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13doc: update aerc-bindsKoni Marti
Update aerc-binds to reflect the code. The contextual account and folder arguments were always evaluated as regular expressions. Also, the contextual arguments do not understand "~" but only "=" (in contrast to the ui contextual parser). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13doc: rephrase aerc-search -d date selectionMoritz Poldrack
Recent mailing list interaction has shown that the current way of phrasing it reduces the visibility of the default YYYY-MM-DD format. Move the default format to be in line with the alternative formats. Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CCVZCP9GEMI1K.2F9Z9JIU1GTA2%40schach.ware.local%3E Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13sort: new `flagged` sorting criteriaVitaly Ovchinnikov
Add new `flagged` criteria to `:sort` command (and apparently to the `sort` config option). Good for moving important stuff up. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13carddav-query: interpret percent escapes in source urlRobin Jarry
The username and password must be percent encoded if they are set in carddav-source. Python's parser does not automatically unquote the different URL elements. Some carddav servers do not care about this but some do and report authentication failures when the username is percent encoded. Make sure to unquote the username and password after reading them from carddav-source. Reported-by: Callum Andrew <contact@candrew.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Callum Andrew <contact@candrew.net>
2023-10-13release.sh: fix email encodingRobin Jarry
The release emails are sent without any Content-Transfer-Encoding nor Content-Type headers. This causes non-ASCII characters to be rendered as garbage by email clients. Here are two examples from the latest release: Mat��j Cepl Nojus Gudinavi��ius Everything is UTF-8 locally, state it explicitly in the email. Use 8bit as transfer encoding since we are not quoting anything. Add a From: header since some sendmail implementations do not add a default value when it is missing. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2023-10-13send: add option to overwrite copy-to folderKoni Marti
Add -t option to specify a folder that will overwrite the default Copy-To folder from accounts.conf. This allows you to keep the sent messages in the desired folder. Use templates to create a keybind and always keep the sent messages in the currently selected folder: :send -t {{.Folder}} Fixes: https://todo.sr.ht/~rjarry/aerc/187 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Maarten van Gompel <proycon@anaproy.nl>
2023-10-13colorize: accept wildcards in stylesJason Cox
Allow using * and ? to match multiple style objects for colorize, as stated in the man page and consistent with aerc's main styles. Fixes: a5c4f5d (colorize: handle spaces in styleset) Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13split: add an alias for horizontal splitinwit
To date, there are two orthogonal commands named :vsplit and :split, which create a vertical and a horizontal split, respectively. Add a :hsplit alias for the latter. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
2023-10-13switcher: add scrollbarKoni Marti
Add scrollbar to part switcher. Add config value "max-mime-height" to the [Viewer] section to set the maximum height before a scrollbar is drawn. The part switcher height is restricted to half of the context height. Update docs. Fixes: https://todo.sr.ht/~rjarry/aerc/194 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13msgviewer: separate part switcher from viewerKoni Marti
Separate part switcher from message viewer. The part switcher implementation was woven into the message viewer code. Decouple them to make the code more readable. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
2023-10-13binds: better processing of contextual bindsVitaly Ovchinnikov
Fix bindings for groups like [compose::review:account=acc1], adds a proper handling of $noinherit=true for contextual bindings. Without the patch contexts like [compose::review:account=acc1] are matching the [view] context which produces errors. Replacing `Contains` with `HasPrefix` seems to be the right thing there. Another change lets you really drop all the previous bindings if the contextual binding has $noinherit=true. Without that the parent bindings are still there regardless of $noinherit flag. Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>