Update message counter in msglist when the filter is changed (either set or
cleared in the msgstore).
When we apply a filter, we change the number of uids in the message
store. This can unintentionally trigger the storeUpdate() function of
the msglist which checks the number of uids for new messages and
advances the pointer by the difference in the number of messages. This
can be avoided when we update the message counter upon changing the
filter.
Fixes: https://todo.sr.ht/~rjarry/aerc/23
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Update statusline only when changed to reduce cpu usage.
commit 2512c0403f ("statusline: implement per-account status") updates
the status irrespective of whether the statusline changed or not. This
can lead to high cpu usage that can be avoided.
Reported-by: Jens Grassel <jens@wegtam.com>
Reported-by: inwit <inwit@sindominio.net>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Implement a statusline state for each account. Keep the ex line and the
push notifications global. Add account name prefix to push
notifications. Prefix status line with account name when multiple
accounts are available.
Use account-specific status line for each tab where an account is
defined.
Handle threading, filter/search, viewer passthrough and connection
status.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
mailto:email@domain.tld is the only exception that does not use the
<scheme>:// prefix.
Requested-by: Moritz Poldrack <moritz@poldrack.dev>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
This commit fixes all occurrences of the abovementioned lint-error in
the codebase.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit fixes all occurrences of the abovementioned lint-error in
the codebase.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit fixes all occurrences of the abovementioned lint-error in
the codebase.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Allow a mailto link to open a new composer even if no recipient is in
the url.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Moritz Poldrack <git@moritz.sh>
Remove code duplication and provide completion even when acct is nil
Signed-off-by: kt programs <ktprograms@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Enable consecutive filter and search queries. Filter narrows down
message list consecutively and clears search results. Search applies to
the current message list.
Fixes: https://todo.sr.ht/~rjarry/aerc/24
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
Tested-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Fix panic in the GetCompletions function when using the keybind for the
terminal command.
Fixes: https://todo.sr.ht/~rjarry/aerc/29
Reported-by: inwit <inwit@sindominio.net>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
When trying to search in less, keys bound to viewer functions can't be
used as part of the search query, which makes the search useless.
Add a view::passthrough binding mode and a :toggle-key-passthrough
command go toggle in and out of that mode. By default, typing '/' in the
viewer is bound to enabling key passthrough and automatically inserting
'/', to easily enter "less" search mode. When in the passthrough mode,
all bindings are ignored by default. The default binds.conf only defines
a single keybinding in that mode: <Esc> to get back out. $ex is bound to
<C-x> to allow typing colons.
Signed-off-by: Kt Programs <ktprograms@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Apply the user-defined sort criteria to the message with the highest
uid in a threaded discussion. Restore the default sort order when
leaving threading mode.
Commit 7811620eb8 ("threading: implement on-the-fly message
threading") introduced message threading with the threaded messages
being only sorted by their message uids irrespective of the defined sorting
criteria. It did not restore the default sort order either.
Reported-by: Sebastien Binet <s@sbinet.org>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Change the option to enable fuzzy completion to be fuzzy-complete, since
it's no longer only used for folders
Signed-off-by: Kt Programs <ktprograms@gmail.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
Fix a data race due dirInfo pointer being read in the main goroutine
by NewMessageStore and written in the anonymous goroutine launched in
Worker.getDirectoryInfo.
To address the issue raised in https://todo.sr.ht/~rjarry/aerc/16, we
use readdir(3) once, parse and cache its results, this replaces
go-maildir library Dir.Flags based stat(3) and filepath.Glob
causing the issue when N (emails) is large.
Signed-off-by: wagner riffel <w@104d.net>
When a signature contains a line that starts with an url, the url is not
highlighted properly:
--
Foobar
[38;2;255;255;175mmhttps://foobar.org
The trailing m of the signature color start \x1b[38;2;175;135;255m is
considered as part of the URL scheme (i.e. mhttps:// instead of
https://). Colorize the URLs first before wrapping with the signature
color.
Fixes: df8c129235 ("filters: port colorize to awk")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Will expand a user-provided custom sharedir, XDG_CONFIG_HOME and
XDG_DATA_HOME if necessary. Will not alter those strings if they do not
begin with a tilde.
Signed-off-by: Daniel Patterson <me@danielpatterson.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
We should use the Makefile value of SHAREDIR when searching for config
files and templates etc.
This is important for systems which do not use the standard file
hierarchy or which do not have a consistent location for installing
program files, for example NixOS, which will have a different install
location with every update.
Signed-off-by: Daniel Patterson <me@danielpatterson.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
* All patches must be signed-off.
* All patches must receive at least one independent review and approval
before being applied.
* Remove the --in-reply-to= option for git send-email. This breaks
lists.sr.ht UI.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: akspecs <akspecs@gmail.com>
Some MUAs (namely Outlook) use localized prefixes for replied-to and
forwarded mail. With this patch aerc replaces known localized prefixes
and repetitions with the common Re: prefix.
Link: https://office-watch.com/2014/outlook-reply-forward-prefixes/
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Extract the vertical scrolling ability into its own Scrollable struct
that can be embedded and reused across any ui element that relies on
scrolling.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
The kept socket after crashes or unclean exits can lead to a unexpected
behaviour. This commit just removes dangling sockets if they exist.
Since the "does not exist" error is the best case scenario error
handling was deemed unnecessary.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
When building with BSD make, running `make` after updating a source file
will not cause the binary to be rebuilt. After inspection, it appears
that the GOSRC variable only contains "go.mod go.sum". The aerc target
does not depend on .go source files.
The $(shell) construct is GNU make specific. BSD make has a special
assignment operator (!=) which evaluates a shell command. Since GNU make
4.0, the BSD != operator is supported for compatibility.
Use a syntax that is available in both make flavours.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
Running make with different values for GOFLAGS or VERSION does not cause
aerc to be rebuilt whereas it should.
Write the go build command line into a file and force aerc to be rebuilt
if the command line has changed.
Use the BSD make compatible != operator to run the command. This
operator is also available in GNU make since version 4.0.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
When messages are marked, pipe their contents into the specified
command. The messages are ordered according to their respective
Message-Id headers. This allows applying complete patch series with
a single command.
When piping more than one message, make sure to write them in the mbox
format as git am expects them to be.
Link: https://en.wikipedia.org/wiki/Mbox
Link: https://github.com/git/git/blob/v2.35.1/builtin/mailsplit.c#L15-L44
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Tested-by: akspecs <akspecs@gmail.com>
aerc.SelectedAccount() is used in lots of places. Most of them without
checking the return value.
In some cases, the currently selected tab is not related to any account
(widget.Terminal for example). This can lead to unexpected crashes when
accessing account specific configuration.
When possible, return an error when no account is currently selected.
If no error can be returned, fallback to non-account specific
configuration.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
implement message threading on the message store level using the
jwz algorithm. Build threads on-the-fly when new message headers arrive.
Use the references header to create the threads and the in-reply-to
header as a fall-back option in case no references header is present.
Does not run when the worker provides its own threading (e.g. imap
server threads).
Include only those message headers that have been fetched and are
stored in the message store.
References: https://www.jwz.org/doc/threading.html
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
Tested-by: akspecs <akspecs@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
add the expand-folder and collapse-folder commands to navigate the
directory tree view. Provide keybinds for a vi-like folder navigation
experience.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
implement a foldable tree for the directory list. Expand all parent
directories when a hidden directory is selected with the change-folder
command.
folders-sort considers the top-level directories only. The folders and
foldersexclude filters work with the full directory path.
Enable tree view by adding 'dirlist-tree=true' to the config file.
Implements: https://todo.sr.ht/~sircmpwn/aerc2/228
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Add an extra attribute to the status line. When non-empty, display it
after the current status.
Set that extra status after a successful :search or :filter. Remove it
after :clear.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Python is not available on all systems. Port the colorize filter to awk
as it is a more widespread POSIX utility.
Users are free to copy the filter into their home dir and tweak the
colors to their needs. The highlighted items are:
=============== ======= ======= ========= =================
Item Red Green Blue Color
=============== ======= ======= ========= =================
quoted text 1 95 175 255 Blue
quoted text 2 255 135 0 Orange
quoted text 3 175 135 255 Purple
quoted text 4 255 95 215 Pink
quoted text * 128 128 128 Grey
diff meta 255 255 255 White bold
diff chunk 205 0 205 Cyan
diff added 0 205 0 Red
diff removed 205 0 0 Green
signature 175 135 255 Purple
header 175 135 255 Purple
url 255 255 175 Yellow
=============== ======= ======= ========= =================
This assumes a terminal emulator with true color support and with
a dark/black background.
Link: https://github.com/termstandard/colors
Signed-off-by: Robin Jarry <robin@jarry.cc>
This script is referenced by some users configuration. Restore it to
avoid breaking existing setups.
Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
This filter script is not compatible with the previous one. Rename it to
avoid issues with existing configs.
Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Start the reconnect cycle when the initial connect fails. Make the
connection observer send a connection error when the imap client is nil.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Parse the terminal capabilities from the TERM environment variable
instead of using a hard coded list of terminals.
tcell does not expose the status line capabilities. Use another library
for this: github.com/xo/terminfo
Signed-off-by: Robin Jarry <robin@jarry.cc>
; is a special character for the INI format. It starts a comment and
apparently cannot be escaped nor quoted. This causes the default
text/plain filter to be truncated and causes this obscure error when
viewing a message:
sh: 1: Syntax error: Unterminated quoted string
Debugging shows that the filter command is:
sh -c "sed 's/^>\\+.*/\\x1b[2"
Remove the explicit dim style. It should be the default anyway.
Fixes: 7c3ce816c8 ("config: set a default filter for text/plain")
Signed-off-by: Robin Jarry <robin@jarry.cc>
The status is not cleared. It is annoying.
Fixes: c37f1eaaea ("filter/search: display current search/filter arguments")
Signed-off-by: Robin Jarry <robin@jarry.cc>