aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* spinner: add spinner-interval config optionDean2023-01-113-9/+18
| | | | | | | | | | The default 200ms between each spinner frame can be unsuitable for spinners with many frames, so this adds a spinner-interval config option with type `time.Duration` to specify the interval between frames. The default is still the usual 200ms. Signed-off-by: Dean <gao.dean@hotmail.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* config: disable ini reflection for pgp-error-levelRobin Jarry2023-01-111-1/+1
| | | | | | | | | This field must be converted from a string value to an integer manually. The conversion cannot be automated via go ini reflection mechanism. Fixes: 2af81a743048 ("pgp: add configurable error level for opportunistic encryption") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jose Lombera <jose@lombera.dev>
* config: fix accounts backend specific parameters detectionRobin Jarry2023-01-111-16/+2
| | | | | | | | | | | | | | | | Since commit c56027b2e69e ("config: cleanup accounts.conf section parsing"), no backend-specific settings are parsed and stored into account.Params. The logic is completely broken. Any key is specific unless one field of the AccountConfig struct has a matching ini:"key" tag. The fields that are tagged ini:"-" are already handled in the parent switch block. Reported-by: Jose Lombera <jose@lombera.dev> Reported-by: Ben Cohen <ben@bencohen.net> Fixes: c56027b2e69e ("config: cleanup accounts.conf section parsing") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jose Lombera <jose@lombera.dev>
* msglist: log template errorsRobin Jarry2023-01-111-0/+1
| | | | | | | | | | The template exec errors can be rather verbose and may be truncated when the table is rendered. Log them as errors so that they can be inspected by users. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* filters: install them in $PREFIX/libexec/aerc/filtersRobin Jarry2023-01-105-14/+35
| | | | | | | | | | | | | | | | | | | | | The filesystem hierarchy standard describes /usr/share as "Architecture-independent data". This folder is not intended for executable scripts and especially not for arch specific binary files (such as the wrap filter). Lintian reports an error with aerc 0.14.0: arch-dependent-file-in-usr-share [usr/share/aerc/filters/wrap] Which I had to fix by moving the filter into /usr/libexec. Install all filters into $PREFIX/libexec/aerc/filters and update the default SearchDirs to look them up in here as well. Link: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s11.html Link: https://salsa.debian.org/go-team/packages/aerc/-/commit/a0ca00260ffd Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* config: make styleset error message clearerBence Ferdinandy2023-01-101-1/+2
| | | | | | | | | When aerc fails to load a styleset it reports being unable to load the default styleset. Change error message to print the name of the styleset instead of default. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: add msglist_answered config optionMartin Lucina2023-01-104-7/+16
| | | | | | | | Add a style for messages that have been marked as answered, and a "msglist_answered" config option for it. Signed-off-by: Martin Lucina <martin@lucina.net> Acked-by: Robin Jarry <robin@jarry.cc>
* changelog: move index-columns in the unreleased sectionRobin Jarry2023-01-081-2/+8
| | | | | | | | This was applied after 0.14.0 was released. I forgot to update my patch before pushing it... Fixes: 535300cfdbfc ("config: add columns based index format") Signed-off-by: Robin Jarry <robin@jarry.cc>
* pgp: add configurable error level for opportunistic encryptionTim Culverhouse2023-01-063-2/+44
| | | | | | | | | | | | | | Add a user-configurable error level for when opportunistic encryption is enabled but the message cannot be encrypted. Set the default level to this as "warn". This config option *only* applies when opportunistic encryption is enabled. If a user tries to manually encrypt a message, an error will still be shown. Don't show encryption status until at least one recipient is added. Fixes: https://todo.sr.ht/~rjarry/aerc/95 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: add missing panic handlers in goroutinesRobin Jarry2023-01-0616-0/+26
| | | | | | | | These issues were all reported by the new custom analyzer introduced in previous commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* contrib: add linter to check for panic handler in goroutinesRobin Jarry2023-01-065-1/+140
| | | | | | | | | | | | | | | | | If log.PanicHandler() is not installed in a goroutine and a panic occurs, the terminal state is not restored. This causes the panic trace to be unreadable since the terminal is broken. Add a custom analyzer that parses our code and ensures that: defer log.PanicHandler() is the first statement of all functions that are executed in goroutines. Include that linter in golangci config. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* doc: fix English typosRobin Jarry2023-01-064-5/+5
| | | | | | | Reported by Lintian (Debian). Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* config: add columns based index formatRobin Jarry2023-01-069-149/+474
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The index-format option comes from mutt and is neither user friendly, nor intuitive. Introduce a new way of configuring the message list contents. Replace index-format with multiple settings to make everything more intuitive. Reuse the table widget added in the previous commit. index-columns Comma-separated list of column names followed by optional alignment and width specifiers. column-separator String separator between columns. column-$name One setting for every name defined in index-columns. This supports golang text/template syntax and allows access to the same message information than before and much more. When index-format is still defined in aerc.conf (which will most likely happen when users will update after this patch), convert it to the new index-columns + column-$name and column-separator system and a warning is displayed on startup so that users are aware that they need to update their config. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* ui: add reusable table widgetRobin Jarry2023-01-042-0/+330
| | | | | | | | | | | | | This will be used by the message list index and by the status line. A table is constructed from rows/width dimensions, a list of column definitions and a column separator. Provide functions to parse column definitions from ini config files. This will be used in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* selector: implement dynamic heightRobin Jarry2023-01-041-3/+17
| | | | | | | | Depending on the number of lines in the prompt text, allow the selector dialog to grow in height. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* format: add utf-8 aware truncate head functionRobin Jarry2023-01-042-0/+27
| | | | | | | | | The runewidth module only allows truncating at the end of strings. Add a function to truncate at the beginning. It will be used for the table widget in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* templates: add more fields and functionsRobin Jarry2023-01-046-40/+556
| | | | | | | | | | | Add functions and fields in preparation for more than only message templates. The idea is to reuse the same symbols for the message list format and other parts of the UI. Update the man page accordingly. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* templates: change fields as lazy functionsRobin Jarry2023-01-0410-50/+79
| | | | | | | | | No need to pre-render fields that are not necessarily accessed in templates. Change fields to functions that are evaluated only when required. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* templates: split code in multiple filesRobin Jarry2023-01-043-182/+193
| | | | | | | This makes room in preparation for more code in here. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: parse account from and aliases onceRobin Jarry2023-01-049-74/+38
| | | | | | | | | Instead of accepting any garbage for these configuration fields, parse them when parsing accounts.conf and store mail.Address objects. Reuse these objects everywhere. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: cleanup accounts.conf section parsingRobin Jarry2023-01-041-52/+48
| | | | | | | | | | Use go ini reflection capabilities where possible. Mark fields that can be trivially parsed and those who need manual parsing. Restrict backend-specific parameters to ini keys that are not listed as ini struct field tags. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* model: change flags array to bitmaskRobin Jarry2023-01-0428-207/+120
| | | | | | | Using a list of integers is not optimal. Use a bit mask instead. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* send: add option to send&archiveBence Ferdinandy2023-01-045-14/+46
| | | | | | | | | Add `:send -a flat|month|year` to send, which archives the message being replied to. Extract most of archive logic into a separate function to make sure it behaves as manual archiving. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* Release version 0.14.00.14.0Robin Jarry2023-01-042-1/+3
| | | | Signed-off-by: Robin Jarry <robin@jarry.cc>
* sendemail-validate: fix compat with older git versionsRobin Jarry2023-01-041-6/+6
| | | | | | | | | | Seen with git 2.34: error: unknown option `empty=drop' Check the patch file manually instead and abort early. Signed-off-by: Robin Jarry <robin@jarry.cc>
* msgstore: fix deadlock in thread builderRobin Jarry2023-01-031-1/+5
| | | | | | | | | | | | | | | | | | When scrolling while the thread builder is running, aerc freezes. This issue can be easily reproduced by keeping the down arrow pressed while a folder is loading with local threading enabled. This is caused by the threadCallback function calling store.Select which acquires threadsMutex. However, threadCallback is already called with threadsMutex acquired, causing a deadlock. Fix the issue by adding a new selectPriv function that does not acquire the lock and call this one in threadCallback *and* store.Select. Do not reset threadCallback to nil as it was before. Fixes: 6b8e0b19d35a ("split: refactor to prevent stuck splits") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Vigouroux <me@vigoux.giize.com>
* changelog: refine before releaseRobin Jarry2023-01-021-11/+17
| | | | | | | | Obviously, this is not exhaustive. But these should be most user visible changes. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* textinput: fix crash when scrolling back in command historyRobin Jarry2023-01-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pressing up while in command mode, calls TextInput.Set() with the previous command in the history. If the command exceeds the current terminal width, there is a scroll mechanism that puts the cursor at the end of the text (see ensureScroll()). However, the offset used to perform the draw is not the current scroll value but the "previous" one. When the one before last command required a longer scroll offset than the current command length, this causes a crash: Error: runtime error: slice bounds out of range [348:5] git.sr.ht/~rjarry/aerc/lib/ui.(*TextInput).Draw(0xc0017ce000, 0xc005460570) git.sr.ht/~rjarry/aerc/lib/ui/textinput.go:111 +0x525 git.sr.ht/~rjarry/aerc/widgets.(*ExLine).Draw(0x30?, 0xc01de13b08?) git.sr.ht/~rjarry/aerc/widgets/exline.go:76 +0x1d git.sr.ht/~rjarry/aerc/lib/ui.(*Stack).Draw(0xc0003f0ff0?, 0x0?) git.sr.ht/~rjarry/aerc/lib/ui/stack.go:30 +0x49 git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).Draw(0xc00038c240, 0xc0003f0ff0) git.sr.ht/~rjarry/aerc/lib/ui/grid.go:126 +0x225 git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Draw(0xc0003f4000, 0xc0003f0ff0) git.sr.ht/~rjarry/aerc/widgets/aerc.go:176 +0x1d2 git.sr.ht/~rjarry/aerc/lib/ui.(*UI).Render(0xc0003a0000) git.sr.ht/~rjarry/aerc/lib/ui/ui.go:110 +0x63 main.main() git.sr.ht/~rjarry/aerc/aerc.go:255 +0x9c5 There are actually two distinct issues here: 1) The scroll offset used for drawing must be the current one, not the one from the previous ensureScoll() call. 2) The scroll offset must be reset when changing the text with TextInput.Set(). Other methods that change the text actually call ensureScroll but they make incremental changes to the text, since Set completely overwrites everything, it makes more sense to set the scroll offset to 0. Reported-by: Adam Cooper <adam@theadamcooper.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* doc: fix numbered listsRobin Jarry2022-12-271-9/+9
| | | | | | | According to scdoc(5), numbered lists start with a period. Fixes: af63bd0188d1 ("doc: homogenize scdoc markup") Signed-off-by: Robin Jarry <robin@jarry.cc>
* split: close split on update of split viewTim Culverhouse2022-12-271-0/+3
| | | | | | | | | | | Commit 6b8e0b19d35a ("split: refactor to prevent stuck splits") introduced a regression where a split message viewer is not closed when a new message is selected, leading to every split view staying open in the background. Fixes: 6b8e0b19d35a ("split: refactor to prevent stuck splits") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* term: upgrade tcell-term to v0.4.0Tim Culverhouse2022-12-272-3/+3
| | | | | | | | | | | Upgrade tcell-term to latest tag. Has only a few fixes: - Always set TERM=xterm-256color for better compatibility - Fix some RGB parsing sequences - Fix splitting of UTF8 bytes causing render issues Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* doc: fix typosFolker Schwesinger2022-12-271-4/+3
| | | | | | | Fix typos in aerc-config man page. Signed-off-by: Folker Schwesinger <dev@folker-schwesinger.de> Acked-by: Robin Jarry <robin@jarry.cc>
* split: refactor to prevent stuck splitsTim Culverhouse2022-12-255-102/+69
| | | | | | | | | | Refactor split logic (again...) to prevent stuck splits. Use callback from msgstore.Select to tell the split which message to display. This keeps the account from having to track displayed messages, which prevents race conditions in certain situations. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* colorize: add 'terminal' theme which respects termcolorsTim Culverhouse2022-12-211-0/+16
| | | | | | | | | | | | Add a "terminal" theme to colorize script. The "terminal" theme respects the users' configured terminal color scheme. Also links are blue underlined. Usage: colorize -v theme=terminal Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* smtp: remove requirement for oauthbearer token-endpointTim Culverhouse2022-12-211-7/+6
| | | | | | | | | | | | | | | The SMTP configuration is slightly different between oauthbearer and xoauth2. The oauthbearer requires a token-endpoint, while xoauth2 does not. The IMAP version of oauthbearer also does not require a token-endpoint. If one is specified, the token is treated as a refresh token. Modify the SMTP usage to work the same way: a token is an access token unless a token-endpoint is specified Reported-by: Cameron Samak <csamak@apache.org> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* sendemail-validate: ignore empty patches from cover letterRobin Jarry2022-12-211-1/+5
| | | | | | Avoid errors by checking cover letters as regular patches. Signed-off-by: Robin Jarry <robin@jarry.cc>
* attach: don't glob hidden filesMoritz Poldrack2022-12-202-0/+26
| | | | | | | | | | | | Most of the time it is not wanted to attach hidden files, but by default globbing does include hidden files. Add a small check that removes hidden files from the results if they are not explicitly globbed for or inside a hidden directory. Implements: https://todo.sr.ht/~rjarry/aerc/83 Signed-off-by: Moritz Poldrack <git@moritz.sh> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* ci: move check-patches at the end of pipelinesRobin Jarry2022-12-202-4/+4
| | | | | | | This is less important than reporting actual coding errors. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* check-patches: ignore .mailmap for author and s-o-b trailer checkRobin Jarry2022-12-201-1/+1
| | | | | | | We don't care that they are known in .mailmap as long as both match. Reported-by: Moritz Poldrack <moritz@poldrack.dev> Signed-off-by: Robin Jarry <robin@jarry.cc>
* wizard: debounce warning to ensure pasted passwords are entered correctlyMoritz Poldrack2022-12-201-1/+12
| | | | | | | | | | | | | When entering passwords from a password-manager the wizard shows it's warning right after the first character has been pasted and the rest of the password is lost. Debounce the displaying of the "stored in plaintext"-warning to only show after the password has been entered. Reported-by: qbit (@qbit:tapenet.org) Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* wizard: fix panic on any key pressRobin Jarry2022-12-191-205/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using :new-account, aerc crashes when entering a letter with the following trace: panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x66930e] goroutine 1 [running]: git.sr.ht/~rjarry/aerc/log.PanicHandler() git.sr.ht/~rjarry/aerc/log/panic-logger.go:51 +0x73e panic({0xa2b200, 0x10204e0}) runtime/panic.go:890 +0x262 git.sr.ht/~rjarry/aerc/config.(*KeyBindings).GetBinding(0xc000370000?, {0xc000634c48?, 0xc000118900?, 0x5843da?}) git.sr.ht/~rjarry/aerc/config/binds.go:331 +0x2e git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Event(0xc000370000, {0xbd1e60?, 0xc00112e000?}) git.sr.ht/~rjarry/aerc/widgets/aerc.go:309 +0x196 git.sr.ht/~rjarry/aerc/lib/ui.(*UI).HandleEvent(0xc00031e840, {0xbd1e60?, 0xc00112e000}) git.sr.ht/~rjarry/aerc/lib/ui/ui.go:141 +0x162 main.main() git.sr.ht/~rjarry/aerc/aerc.go:246 +0xa89 The issue is that the keyNames map is empty when defaultBindsConfig() is called and ParseBinding("<C-q>", ":quit<Enter>") returns an error: Unknown key 'C-q' which is (unfortunately) ignored and nil is inserted in the wizard bindings. Fix that by initializing keyNames at the module level and remove init(). Fixes: c05c2ffe0424 ("config: make various sections accessible via global vars") Reported-by: Moritz Poldrack <moritz@poldrack.dev> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* split: use a sensible default widthMoritz Poldrack2022-12-193-2/+14
| | | | | | | | | | | | | Guessing a width/height with v?split is rather bothersome, using a sensible value based on the user's terminal would be preferable. This also prevents confusion when running :v?split without a number seemingly does not open a split. Initialize width as half the width of the message list and height as an eight of the message list. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: make width available externallyMoritz Poldrack2022-12-191-0/+6
| | | | | | | This will be reused in next commit. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* mk: remove verbose for testsRobin Jarry2022-12-181-1/+1
| | | | | | This is useless and annoying. Signed-off-by: Robin Jarry <robin@jarry.cc>
* sendemail-validate: add human readable recommendationsRobin Jarry2022-12-151-3/+11
| | | | | | | | | | | | When the patch fails to apply, users may get an obscure error from git: error: sha1 information is lacking or useless (commands/msg/reply.go). error: could not build fake ancestor Add explicit error messages indicating what happened and what should be done. Signed-off-by: Robin Jarry <robin@jarry.cc>
* reply: refactor close-on-reply setting to -c flagBence Ferdinandy2022-12-155-15/+15
| | | | | | | | Previously close-on-reply was implemented as a setting, making it unflexible. Refactor so it is a flag to reply `:reply -c`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* wrap: handle letters as list itemsRobin Jarry2022-12-141-1/+1
| | | | | | | | | | | In addition of digits, handle lower case letters as list items: a) foo b) baz c) bar Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* contributing: add tooling for git send-emailRobin Jarry2022-12-145-2/+70
| | | | | | | | | | | | | | | | | | | | | | | | | Add a gitconfig target in the Makefile to configure a new clone with sane defaults: - set subject prefix - set correct mailing list address - enable sendemail.validate - install sendemail-validate hook The sendemail-validate hook will make a shallow clone of the current upstream repo, apply every patch on it and run some checks (a stripped down version of what is run by the upstream CI). Add a new check-patches script that verifies that the commit message actually contains something and that the Signed-off-by trailer from the patch author is present. Call check-patches in both the CI and the sendemail-validate hook. Update CONTRIBUTING.md accordingly. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: add a default flag to icon-attachmentBen Cohen2022-12-141-0/+1
| | | | | | | | Set a default flag character for icon-attachment to match the man page. Fixes: adf74be4b5c5 ("msglist: add attachment indicator") Signed-off-by: Ben Cohen <ben@bencohen.net> Acked-by: Robin Jarry <robin@jarry.cc>
* threads: rebuild server threads when updating threadsTim Culverhouse2022-12-142-2/+13
| | | | | | | | | | | | | | | | | The addition of the iterator factory added a thread builder when using server side threads. A conditional for returning UIDs when selecting messages would check for a not-nil store.builder, and return UIDs from the thread builder. When using server side threads, there was no mechanism to update the threads after a message deletion or move, so store.Uids() would return a stale set of UIDs. This would allow the user to "select" a deleted email (the cursor would disappear). Add an update mechanism for the threads if server side threads are enabled. When building thread UIDs, check for deleted or hidden threads. Fixes: https://todo.sr.ht/~rjarry/aerc/123 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net>