Reorder seqmap asserts to properly show display expected and actual when
performing go test -v ./...
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Document filter input charset
Add w3m filter example to default config
Adapt html and html-unsafe filters
Fixes: https://todo.sr.ht/~rjarry/aerc/65
Signed-off-by: q3cpma <q3cpma@posteo.net>
Acked-by: Robin Jarry <robin@jarry.cc>
Specify an account parameter in the mailto argument. If not specified,
the selected account is used as default.
Example:
$ aerc 'mailto:user@host?account=Fastmail'
Suggested-by: staceee
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Commit 27425c15c4 ("autocompletion: fix slice out of bounds access")
introduced a regression in the autocompletion that messes up the order
of last entered chars when autocompletion runs.
The ranges for a slice a[low:high] are 0 <= low <= high <= len(a) [0]
To reproduce with the ":cf" command:
1) enter ":c"
2) wait for autocompleteion
3) enter "f"
4) the prompt will now be ":fc"
[0]: https://go.dev/ref/spec#Slice_expressions
Fixes: 27425c15c4 ("autocompletion: fix slice out of bounds access")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Select the first message with NextPrev when the cursor disappears after
applying a filter where the selected message is not part of. Currently,
the NextPrev would select the last message in the mailbox (like a G
jump).
To reproduce:
1) select a message
2) apply a filter where the selected message is not selected
3) move the cursor and it will jump to the last message
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Archive, delete, and move all remove messages from the message store.
The commands themselves invalidated the message list. The message list
was also invalidated for every MessagesDeleted message received. Remove
the call in the command logic to reduce redraws of the message list
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Move and Archive used store.Next to select the next message. When moving
or archiving multiple messages with an upward movement, this would
result in a to-be-removed message being selected. Use findNextNonDeleted
function to select the correct next message for these commands.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Commit "4753cfd visual-mode: deselect messages after performing command"
introduced the behavior of leaving visual mark mode after performing
certain commands. Add this behavior to additional commands:
- Delete
- Archive
- Move
Remark the selected mail files if an error occurred during the
operation.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Add :check-mail command for ad-hoc checking of mail. Reset timer for
automatic checking if it is enabled.
Suggested-by: staceee
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Send error message to UI if check-mail-cmd is required but not set.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Git send-email Message-Id headers have the following format:
DATETIME.PID-NUM-COMMITTER
Unfortunately, when there are more than 9 patches, the patch number
(NUM) is not zero-padded which makes ascii sorting invalid, e.g.:
1 10 11 12 2 3 4 5 6 7 8 9
Instead of:
1 2 3 4 5 6 7 8 9 10 11 12
We need the patches to be ordered correctly to pipe them to git am.
Make sure to pad the patch number with zero characters to allow series
of up to 999 patches.
Only re-order messages before piping them if all the Message-Id headers
look like git-send-email headers.
Link: https://github.com/git/git/blob/v2.36.0/git-send-email.perl#L1197
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
Set the SkipSort flag when sending directory infos for counting
purposes. Without this, the directory infos would trigger a directory
fetch which could bring the notmuch threads out of sync with the message
list. The notmuch backend sends these directory infos automatically
every minute.
To reproduce the weird cursor movement in notmuch's threaded view:
1. enter threaded view in notmuch
2. wait 1 min (until the auto directory infos are sent out)
3. move cursor around and notice how it jumps over threads
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Tim Culverhouse <tim@timculverhouse.com>
This can be useful in cases when:
1. outgoing-cred-cmd requires a user action or confirmation (e.g. when
using pass with a Yubikey or similar smart card that requires a user
to enter a pin or touch the device when decrypting the password)
2. A user starts aerc frequently, but not all the sessions end up with
sending emails
3. So the user only wants to execute outgoing-cred-cmd when the password
is really used, so the user doesn't have to enter pin or touch their
Yubikey each time aerc starts
Signed-off-by: Stas Rudakou <stas@garage22.net>
Acked-by: Robin Jarry <robin@jarry.cc>
This is a workaround for https://todo.sr.ht/~rjarry/aerc/22, by
injecting zero-width spaces in front of wide characters to make up width
calculation in fmt.Sprintf.
With this applied, columns will still be misaligned a little only if
they are left with trailing zero-width spaces when cut. It is better
than a large offset caused by each wide characters in the column.
References: https://todo.sr.ht/~rjarry/aerc/22
Signed-off-by: Pinghao Wu <xdavidwuph@gmail.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
Git history is not for everyone. Let's introduce a user-oriented change
log. Ideally, this file should be updated incrementally when adding
a new feature. I have added contributors guidelines in README.md.
Update release.sh to automatically generate the release tag message with
the unreleased changes from the changelog.
Link: https://keepachangelog.com/en/1.0.0/
Signed-off-by: Robin Jarry <robin@jarry.cc>
Remove unused code in the handleDeleteMessages routine. During
debugging, it was found that the channel for expunge updates was not
working and that all expunge details were coming through as
ExpungeUpdates. The reporting channel is unneeded.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Fix a regression introduced by commit c2f4404fca ("threading: enable
filtering of server-side threads"). Prior to this commit, a :sort
command (no args) would clear out the current sort criteria (or rather,
apply the value from the config). Restore this functionality.
Fixes: c2f4404fca ("threading: enable filtering of server-side threads")
Reported-by: akspecs <akspecs@gmail.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Use the capabilities returned by the backend to check whether sort is
implemented when the user tries to use the sort command. Print a warning
to the log when a sort request is silently dropped by the backend.
Suggested-by: |cos|
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Try to keep the position in the message list when scrolling through
threaded messages to match the scrolling behavior of the regular view.
This only needs to be implemented for the client-side threading since we
have to rebuild the threads when new messages arrive.
Reported-by: akspecs <akspecs@gmail.com>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Akspecs <akspecs@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Client-side thread debouncing happens in a different goroutine. Any
function or variable that is called or accessed by this goroutine should
be protected from a concurrent access.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Debounce client-side thread building in the message store. Debouncing is
useful when multiple messages are loaded, i.e. when scrolling with
PgUp/PgDown.
Without the debouncing, all client-side threads will be built everytime
the message store is updated which creates a noticable lag in the
message list ui when client-side threading is activated.
The default debouncing delay can be changed by changing
'client-threads-delay' in the UI config section.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
check-mail was triggered to run at startup after a Done:FetchHeaders
message. This message would only occur if there were messages in the
default folder. In the case where there are no messages, check-mail
would not run at startup as intended. Run check-mail even if there are
no messages found in the default folder at startup.
Fixes: https://todo.sr.ht/~rjarry/aerc/60
Reported-by: ~foutrelis
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Improve the function to find the next valid message after the delete
operation. This ensures that messages at the end or when marked in the
visual mode are properly dealt with.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Change the message store architecture from an index-based to a uid-based
one. Key advantage of this design approach is that no reselect mechanism
is required anymore since it comes with the design for free.
Fixes: https://todo.sr.ht/~rjarry/aerc/43
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This prevents dereferencing nil when updating RUE counts. This seems to
happen for messages that were not yet loaded, but were selected for
copy operation. This can happen when using `mark -a` command and then
initiating copy operation.
When such message is encountered during RUE counting, it is stopped
and full recount is triggered.
**Original backtrace:**
Error: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x65
git.sr.ht/~rjarry/aerc/logging.PanicHandler()
git.sr.ht/~rjarry/aerc/logging/panic-logger.go:45 +0x64b
panic({0x9e5f80, 0xecc360})
runtime/panic.go:844 +0x258
git.sr.ht/~rjarry/aerc/widgets.(*AccountView).onMessage(0xc0001be870, {0xb7f860?, 0xc00073b4c0?})
git.sr.ht/~rjarry/aerc/widgets/account.go:353 +0xecc
git.sr.ht/~rjarry/aerc/widgets.(*AccountView).Tick(0xc0001be870)
git.sr.ht/~rjarry/aerc/widgets/account.go:116 +0x6c
git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Tick(0xc0003ba000)
git.sr.ht/~rjarry/aerc/widgets/aerc.go:144 +0x7a
main.main()
git.sr.ht/~rjarry/aerc/aerc.go:225 +0xbb8
Signed-off-by: Ensar Sarajčić <dev@ensarsarajcic.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Rewrite of the awk calendar filter to make it posix compliant. Tested
with awk --posix (awk -V = GNU Awk 5.1.1). Also added some improvements
to readability and formatting.
This complements commit 3ef4a3ca05 ("filters: try and make awk scripts
posix compliant").
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This patch updates the seqNums after an Expunge operation. When an
expunge operation occurs, the seqNum of the deleted message is reported.
The Imap spec [0] states that an immediate decrement of all seqnums greater
than the deleted occurs, even before the next reporting of an expunge
update.
[0]: https://datatracker.ietf.org/doc/html/rfc3501#section-7.4.1
Fixes: https://todo.sr.ht/~rjarry/aerc/61
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
If the last message is deleted, the new selection should be the last
message instead of the first message.
Fixes: https://todo.sr.ht/~rjarry/aerc/59
Reported-by: Sebastien Binet <s@sbinet.org>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Move tab replacement logic for next-message-on-delete into the
callback. This also moves the Invalidate() call into the callback, and
should make imap deletion UI work more reliably - there is a race
condition between the worker and the UI in displaying deleted messages.
This should resolve the race condition, and also only remove the MsgView
tab if the message is actually deleted.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Calling :prev without this check can cause the index to go below 0 if
the current index is smaller than the value being scrolled / incremented
by. This results in the email selector wrapping around from the top to
the bottom most email in the mailbox folder due to changes in ec150f0
'store: fix Select behaviour'.
Signed-off-by: akspecs <akspecs@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Refactor NextPrev to use already existing selection methods and bounds
checking
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Fix the behavior of the Select(index int) method to select the last
message if an index > len(list) or select from bottom of list for
negative indexes.
Thanks: akspecs <akspecs@gmail.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Do not pass logger objects around anymore. Shuffle some messages to make
them consistent with the new logging API. Avoid using %v when a more
specific verb exists for the argument types.
The loggers are completely disabled (i.e. Sprintf is not even called)
by default. They are only enabled when redirecting stdout to a file.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
The built-in logging system is rather basic. Implement a multi-level
logger to ease interpreting the logs. Configure the loggers with
prefixes and microsecond precision for timestamps.
Also, prefix the messages with the source file name and line number.
Because of this, enabling the logs has a performance cost. They will
only be enabled when redirecting aerc stdout to a file.
Here is an example output:
DEBUG 2022/07/20 12:52:34.536190 worker.go:45: PostAction *types.FetchDirectoryContents
DEBUG 2022/07/20 12:52:34.536329 worker.go:92: ProcessAction *types.FetchDirectoryContents(2417)
DEBUG 2022/07/20 12:52:34.536407 idler.go:159: idler (0xc00017c000) [idle:false,wait:false] =>(idle) [debounce]
INFO 2022/07/20 12:52:34.536432 threadbuilder.go:59: 130 threads created in 220.796µs
DEBUG 2022/07/20 12:52:34.536449 worker.go:75: ProcessMessage *types.DirectoryInfo(2416)
DEBUG 2022/07/20 12:52:34.536453 idler.go:159: idler (0xc00017c000) [idle:false,wait:false] <=(idle)
DEBUG 2022/07/20 12:52:34.536459 worker.go:45: PostAction *types.FetchDirectoryContents
INFO 2022/07/20 12:52:34.536470 open.go:30: Fetching UID list
INFO 2022/07/20 12:52:34.536689 threadbuilder.go:59: 130 threads created in 201.635µs
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
This causes all raw email bodies to be dumped along with actual
debugging messages. I don't believe we neither need nor want such
a thing.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Some contributors use multiple email addresses and/or invalid email
addresses. Add a .mailmap file to de-duplicate and fix contributors
names with git shortlog.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Shuffle the To/Cc/Bcc headers to avoid people from doing reply all to
~sircmpwn/aerc@lists.sr.ht. Also add Cc: aerc-devel so that the lists
archives all have the base message. Unfortunately, there is no way to
prevent people from doing reply all and trying to send emails to
aerc-announce. Putting aerc-announce in Bcc sounds very ugly.
Include the person doing the release as Bcc. sendmail -t does not have
a copy-to=Sent option.
Use base32 and a shorter suffix for Message-ID. base64 is ugly.
Use 'vi' if $EDITOR is unset.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Protect the access to the tabs array and current index with a mutex.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Koni Marti <koni.marti@gmail.com>
The Tabs object exposes an array of Tab objects and the current selected
index in that array. The these two fields are sometimes modified in
goroutines, which can lead to data races causing fatal out of bounds
accesses on the tab array.
Hide these fields as private API. Expose only what needs to be seen from
the outside. This will prepare for protecting concurrent access with
a lock in the next commit.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Koni Marti <koni.marti@gmail.com>
This function returns an ui.Drawable. Use a more explicit name. This
prepares for adding a new SelectedTab function which will return
an ui.Tab.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Koni Marti <koni.marti@gmail.com>
Cleanup existing PartSwitcher before recreating a new one when command
:toggle-headers is executed, ensuring existing part pagers are cleaned
up. This fixes a leak in pager processes when :toggle-headers is
executed repeatedly without closing the message.
Signed-off-by: Jose Lombera <jose@lombera.dev>
Acked-by: Koni Marti <koni.marti@gmail.com>
When opening unread emails from certain people (I won't name any names,
sorry), an annoying error message is displayed on the status line:
could not get section &imap.BodySectionName{BodyPartName:
imap.BodyPartName{Specifier:"", Path:[]int(nil), Fields:[]string(nil),
NotFields:false}, Peek:false, Partial:[]int(nil), value}
This does not occur for already read messages. This issue is similar to
the one that was fixed in commit 8ed95b0d2a ("imap: avoid crash when
replying to unread message").
This happens because the flags are updated in the callback that receives
the message itself. It causes the flag update to arrive in the same
channel/request. Ignore the messages that have an empty body (i.e. only
containing flag updates). This is inherently racy but there seems no way
to get rid of these extra messages.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Koni Marti <koni.marti@gmail.com>
This makes it more explicit for non pgp compatible clients. Without
this, they may show "unnamed part" or "noname".
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>