summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-28Release version 0.15.10.15.1Robin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-04-28changelog: update before releaseRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-04-28maildir: fix handling of FSEventsTim Culverhouse
Maildir uses a filesystem watcher to watch the currently selected directory for changes, updating the UI as necessary. Not all changes get updated based on the current logic. Send a MessageInfo if the event was a Rename. Send a MessagesDeleted if the event was a Remove. Tell the UI to refetch the list if the event was a Create. Note: This leads to some unnecessary fetching in the UI, as renames also come with a Create event in most cases. Koni suggested sending the MessageInfo and having the UI perform a binary search and inserting the message in the proper position. This is optimization is left out of this series, with a TODO left in the code. Fixes: https://todo.sr.ht/~rjarry/aerc/171 Fixes: 91ac21ac6155 ("msgstore: fetch message list based on OpenDirectory msg") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-27term: upgrade tcell-termTim Culverhouse
Upgrade tcell-term, includes a bug fix when CUP is sent with only one param. Fixes: https://todo.sr.ht/~rjarry/aerc/170 Tested-by: ~staceeharper Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-27compose: do not strip leading space from signatureRobin Jarry
Only strip the leading whitespace when a delimiter needs to be prepended. Fixes: bba715975690 ("compose: only add delimiter when a signature is defined") Reported-by: Jason Cox <dev@jasoncarloscox.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Jason Cox <dev@jasoncarloscox.com>
2023-04-27ui: avoid races with queue redrawRobin Jarry
When calling ui.QueueRedraw() and a redraw is currently in progress, the redraw int value still holds REDRAW_PENDING since it is updated once the redraw is finished. This can lead to incomplete screen redraws on the embedded terminal. Even changing the redraw value before starting to redraw is exposed to races. Use a single atomic int to represent the state of the UI so that there cannot be any confusion. Rename the constants to make them less confusing. Fixes: b148b94cfe1f ("ui: avoid duplicate queued redraws") Reported-by: Jason Cox <dev@jasoncarloscox.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jason Cox <dev@jasoncarloscox.com>
2023-04-27imap: avoid error log when pruning cache entriesRobin Jarry
Avoid such errors in the logs: ERROR cache.go:187: cannot clean database 0: unexpected EOF The cache now contains a tag mapped to a special key. This is not a gob serialized cached header. Ignore it when pruning old cache entries. Fixes: 6ea0f18635a8 ("imap: clear cache on tag mismatch") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2023-04-26Release version 0.15.00.15.0Robin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-04-26ui: avoid duplicate queued redrawsRobin Jarry
No need to queue multiple nil messages to force multiple redraws. Only one is required. When the screen is redrawn, clear the queued redraw flag. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2023-04-26term: fix handling of failed commandTim Culverhouse
A panic occurs when a terminal is launched with a command that fails: :term blabla The underlying terminal does not need to be closed if the command failed to start: all resources are cleaned up upon failure to start already. Don't attempt to close terminal if the command didn't start. With the above fix in place, the tab will linger around until a redraw occurs, as there is nothing queuing a redraw on this behavior. Add a QueueRedraw in the tabs.Remove method to clean up the tabbar. The issue in tcell-term that causes this panic has been address there as well, released as 0.7.1. Update aerc's version. Reported-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-26imap: add size field to cache structKoni Marti
Add size field to the cache struct and increment cache tag. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-26imap: clear cache on tag mismatchKoni Marti
Tag the imap cache and clear it when the cache tag does not match the current tag in the code. This ensures that the cache structure is always consitent with our code base. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-26messageinfo: report message sizesKoni Marti
Report sizes of the message across all backends. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-24mod: update all dependenciesRobin Jarry
Result of the following commands: go get -u -t go mod tidy -compat=1.18 I also updated gofumpt version in the makefile. golangci-lint cannot be updated to 1.52.* which requires go 1.19 or later. Aerc has a minimum required version of 1.18. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-24mod: drop support for go 1.17Robin Jarry
A lot of libraries are starting to use generics (introduced in go 1.18). Restricting aerc on 1.17 prevents us from updating our dependencies. Since 1.18 is a major milestone, it has a chance to remain supported for a while. Update the minimum go version to 1.18. Run go mod tidy -compat=1.18. Update our CI to run on 1.18. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-24changelog: add missing entriesRobin Jarry
These slipped through the cracks. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-24term: add config options for TERM and osc8Tim Culverhouse
Add config options for setting the TERM environment variable used in tcell-term and for enabling or disabling OSC8 escape sequence output. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-23tcell-term: upgrade to latest releaseTim Culverhouse
Upgrade tcell-term to latest release. This is a complete rewrite of tcell-term, and includes many minor bug fixes and overall improvements. Notably: - Improved parsing - One fewer goroutine - Improved API - Improved redraw messaging - Improved key support - Improved mouse support Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22colorize: support email domains that start/end with digitsRobin Jarry
According to RFC 1123: "... a host domain name is now allowed to begin with a digit and could legally be entirely numeric ..." Link: https://datatracker.ietf.org/doc/html/rfc1123#section-2 Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-22mailto: add template parameterKoni Marti
Add template parameter to the mailto query and set the config.Template.NewMessage template file as default. Fixes: https://todo.sr.ht/~rjarry/aerc/145 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22search: handle headers in search/filter queryJulian Marcos
Handle headers in the search and filter commands, for searching and filtering based on the Headers specified by the -H parameter, the syntax for the -H parameter should be `Header: Key`. Signed-off-by: Julian Marcos <jmjl@tilde.green> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22directory: add role to template fieldsTim Culverhouse
Add .Role as a template field for use in distinguishing between mailboxes with a given IANA role, or custom role defined by aerc ("query" for notmuch queries, for example). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22directory: add IANA mailbox rolesTim Culverhouse
Add IANA registered mailbox role, and a custom aerc role "query". This will be used in subsequent commits which add the Role field to templates, allowing users to style mailbox by IANA role, or style notmuch queries differently than maildir dirs when using the notmuch worker + maildir option. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22directory: use directory to store rue countsTim Culverhouse
Store the Directory RUE counts on the Directory data model. Use DirectoryInfo messages to update the Directory model. Access Directories via the dirlist instead of via the msgstore. Remove unused fields on DirectoryInfo, all backends now give accurate counts. Move refetch logic into dirlist Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22imap: update directory on flag opsTim Culverhouse
All other backends automatically update directory counts by sending a directory info when a flag operation is performed. Unify the imap backend to this model by posting a CheckMail action, which requests an updated status from the server and posts a DirectoryInfo message Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22dirstore: store directory model in dirstoreTim Culverhouse
Use the dirstore to store models.Directory data structures. This will be used in subsequent commits for accessing directory data. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-22directory: remove attributes fieldTim Culverhouse
Remove the unused field Attributes Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-22listDirectories: refactor listdirectories handlingTim Culverhouse
ListDirectories is called when connecting, reconnecting, and creation/deletion of a directory. The code is not in the same style as other areas of aerc. Refactor to match coding style of the rest of aerc by creating an Update function which handles necessary updates in the dirlist. This style does not use a callback, making it clearer what is happening in the message flow, and operates similar to how the msgstore receives updates. Use a map in the dirstore to reduce duplicate storage of directory names. Directly add or remove directories from the map when created / deleted to prevent a new ListDirectories message, and a flash of the UI. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-22msgstore: create from types.Directory messageTim Culverhouse
Create msgstores when a types.Directory message is received. This removes a quirk from the IMAP worker that msgstores are created on the first DirectoryInfo, and updated on the second. This path requires three messages in order to get an updated message store. By creating from types.Directory, we ensure that any subsequent DirectoryInfo can be routed to a msgstore. Remove the field DirInfo from the msgstore initializer, it isn't needed at initialization and isn't available with this refactor. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-22capabilities: report capabilities from backendTim Culverhouse
Use the Backend interface to report Backend capabilities. Previously, these were reported via a DirectoryInfo message, however they have nothing to do with a directory and should be reported directly by the backend. Add Capabilities method to Backend interface, satisfy this in each backend, and use it on the UI side. Remove Caps field from DirectoryInfo Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
2023-04-22imap: properly handle mailbox status updatesTim Culverhouse
Mailbox status updates received from the IMAP server do not come with the information being sent to the UI. Use the update signal to instead trigger a check-mail of the directory the status was sent for. The status update comes with the following data: - Messages in the mailbox - Recent messages in the mailbox - Sequence number of the first Unseen message - Flags in the mailbox The data we actually we want to send to the UI: - Messages in the mailbox - Recent messages in the mailbox - Unseen messages in the mailbox Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-22msgstore: fetch message list based on OpenDirectory msgTim Culverhouse
Fetching the message list is done in a convoluted way. The UI receives a DirectoryInfo message, which creates a message store. It then receives a second DirectoryInfo (an oddity from the IMAP worker), and this DirectoryInfo is passed to the message store which then requests a fetch of the message list via store.Sort. Use the OpenDirectory done response to tell the message store to fetch messages. This makes the code easier to follow, and does not rely on quirks from the IMAP worker. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-15colorize: don't print an id in osc8 terminatorTim Culverhouse
Printing an ID in the OSC8 terminator can cause issues in some pagers and/or terminals. The "spec" doesn't allow for an ID in the terminator, but most applications and terminals will ignore it if it's there. Prevent printing it in the first place for better compatibility. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-15templates: change layered fg & bg color prioritiesRobin Jarry
This is mostly a revert of commit ae4d742c5a90 ("templates: fix layered fg & bg color for inline styles"). As it turns out, context colors (msglist_selected, msglist_marked, msglist_deleted, etc.) need to have priority over inline colors. Otherwise strange and confusing results occur. Reported-by: Skejg <grolleman@zoho.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
2023-04-15term: update tab title even when tab is not selectedRobin Jarry
When a terminal widget title is updated, the screen is not redrawn. Only the UI state is invalidated so that on the next redraw, the title will be refreshed. Make sure that the screen is redrawn when the title changes. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
2023-04-15term: ignore redraw events when not visibleRobin Jarry
Another attempt at fixing the high CPU usage when terminal tabs are running interactive tui applications and the message list tab is selected. There are cases where a terminal widget can be visible but not focused (composer, message viewer, attachment selector, etc.). Define a new Visible interface with a single Show() method. Call that method when changing tabs to make sure that terminal widget content events only trigger redraws when they are visible. Fixes: 382aea4a9426 ("terminal: avoid high cpu usage when not focused") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
2023-04-15dialog: avoid panic when window is too smallRobin Jarry
Avoid negative offsets and limit height to the parent context height. Fixes: https://todo.sr.ht/~rjarry/aerc/142 Reported-by: Akspecs <akspecs@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
2023-04-10chore: fix typos in contributing guidelinesMoritz Poldrack
As many do not know, step-by-step is actually an adjective in its own right. Debugging is also written with three g and not with two. Link: https://www.merriam-webster.com/thesaurus/step-by-step Link: https://www.merriam-webster.com/thesaurus/debugging Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-10attach: focus terminal for file pickerKoni Marti
Focus terminal for file picker to ensure that terminal is correctly redrawn when using it. After commit 382aea4a ("terminal: avoid high cpu usage when not focused"), the file picker terminal in the attach command (when called with the -m flag) would not work as expected. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-04-10wrap: do not strip signature delimiter trailing spaceRobin Jarry
Some tools expect this trailing space to be present to detect email signatures start. Reported-by: Jd <john1doe@ya.ru> Fixes: https://todo.sr.ht/~rjarry/aerc/131 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jd <john1doe@ya.ru>
2023-04-10doc: clarify layered styles render priorityRobin Jarry
With all the new different options, the behaviour can be confusing. Add explicit rules and examples to avoid ambiguities. Reported-by: skejg <grolleman@zoho.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Inwit <inwit@sindominio.net>
2023-04-04terminal: avoid high cpu usage when not focusedRobin Jarry
When running dynamic tui applications (such as btop, htop, etc.) in the embedded :terminal and focusing an account tab, every tui application change triggers a full redraw of the whole window. When the message list is focused, this leads to high cpu usage because of the computationally intensive templates parsing and ansi sequence handling. Only redraw when the terminal is focused. Do not use tcell Watch and Unwatch functions since these completely disable all widget updates, including title changes and terminal close events. Reported-by: John Mcenroy <handplanet@outlook.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: John Mcenroy <handplanet@outlook.com>
2023-04-02stylesets: fix *.selected parsingRobin Jarry
The stylesets are parsed in two passes. The first pass skips the .selected keys and updates the attributes and colors of both the objects and selected maps. The second pass is supposed to only update the selected map of the pointed style objects. The boolean logic was incorrect, the .selected styles were applied on normal objects as well which led to confusing behaviour most specifically when using *.selected.toggle=true. Properly parse .selected elements. Fixes: 47675e80850d ("config: rework styleset parsing") Reported-by: John Mcenroy <handplanet@outlook.com> Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
2023-04-02colorize: make url parsing more robustRobin Jarry
Reuse the URL parsing algorithm from foot. Basically, it involves recording the opening [, (, < and take into account their closing counterparts. If a closing character is encountered with no matching opening one, assume the URL ends. This allows handling markdown link syntax such as: [http://foobaz.org/xxx](http://foobaz.org/xxx) Avoid coloring bare URL protocols such as http:// or https:// Update test vector to handle more corner cases. Link: https://codeberg.org/dnkl/foot/src/tag/1.13.1/url-mode.c#L331-L471 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
2023-04-02accounts: warn for starttls deprecation only onceRobin Jarry
If the user has several accounts with smtp-starttls=yes set, they will be warned multiple times for each account. This is confusing and may let the user believe that aerc is stuck because closing the dialog seems to have no effect. Only warn once. Fixes: c09b17a930cc ("smtp: replace smtp-starttls with schema option") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2023-04-01hooks: add aerc-shutdownMoritz Poldrack
Add a hook to run when aerc shuts down. The environment is supplemented with the duration aerc was alive for. References: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-01hooks: add aerc-startup hookMoritz Poldrack
Add a hook to run when aerc starts up. The environment is supplemented with aerc version and the path to its binary. References: https://todo.sr.ht/~rjarry/aerc/136 References: https://todo.sr.ht/~rjarry/aerc/139 Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-01config: replace triggers with hooksMoritz Poldrack
Deprecate triggers and replace them with hooks. Now that aerc supports running arbitrary ex commands over IPC, it is possible to run internal aerc commands *and* shell commands via external shell scripts. Hooks only allow running shell commands. Hooks info is passed via environment variables. Implements: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-01tabs: make sure to close tab contentRobin Jarry
Rework how tabs are closed. Change the aerc.RemoveTab and aerc.ReplaceTab functions to accept a new boolean argument. If true, make sure to close the tab content. Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-03-31config: remove subject contextual ui sectionsRobin Jarry
We have been wanting to remove this for a while now. The only use case is styleset and changing the whole styleset based on an email subject does not make much sense. The same feature can be achieve with dynamic msglist* styles based on any email header value in the stylesets now. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>