summaryrefslogtreecommitdiff
path: root/widgets/aerc.go
AgeCommit message (Collapse)Author
2022-07-10aerc: fix panic when backend is unknownKoni Marti
A panic occurs when an unknown backend is used. This regression was introduced by commit a34be9eb36d2 ("status: use contextual ui styleset for statusline"). Before this commit, an error screen for the unknown backend was displayed. The contextual ui requires an account-specific ui config but when the backend throws an error in the constructor of the account view, the call to aerc.SelectedAccountUiConfig() panics: panic: runtime error: index out of range [0] with length 0 [recovered] panic: runtime error: index out of range [0] with length 0 goroutine 1 [running]: git.sr.ht/~rjarry/aerc/logging.PanicHandler() git.sr.ht/~rjarry/aerc/logging/panic-logger.go:47 +0x6de panic({0xa42760, 0xc000427068}) runtime/panic.go:844 +0x258 git.sr.ht/~rjarry/aerc/widgets.(*Aerc).SelectedTab(...) git.sr.ht/~rjarry/aerc/widgets/aerc.go:337 git.sr.ht/~rjarry/aerc/widgets.(*Aerc).SelectedAccount(...) git.sr.ht/~rjarry/aerc/widgets/aerc.go:313 git.sr.ht/~rjarry/aerc/widgets.(*Aerc).SelectedAccountUiConfig(0x9c99c0?) git.sr.ht/~rjarry/aerc/widgets/aerc.go:329 +0xe9 git.sr.ht/~rjarry/aerc/widgets.(*StatusLine).uiConfig(...) git.sr.ht/~rjarry/aerc/widgets/status.go:112 git.sr.ht/~rjarry/aerc/widgets.(*StatusLine).SetError(0xc00043a420, {0xc000429220, 0x1b}) git.sr.ht/~rjarry/aerc/widgets/status.go:66 +0x4d git.sr.ht/~rjarry/aerc/widgets.(*Aerc).SetError(0xa7c4d7?, {0xc000429220?, 0xc00035ec80?}) git.sr.ht/~rjarry/aerc/widgets/aerc.go:440 +0x25 git.sr.ht/~rjarry/aerc/widgets.NewAccountView(0xc000502000, 0xc0002b8000, 0xc000440700, 0xc000098960, {0xb72d58?, 0xc000502000}, 0xc00042c3c0) git.sr.ht/~rjarry/aerc/widgets/account.go:75 +0xafa git.sr.ht/~rjarry/aerc/widgets.NewAerc(0xc0002b8000, 0xc000098960, {0xb73300?, 0xc0004380f0}, 0xc000420108, 0xc000430630, {0xb71580?, 0xfae9a0}, 0x2?) git.sr.ht/~rjarry/aerc/widgets/aerc.go:92 +0x8e5 main.main() git.sr.ht/~rjarry/aerc/aerc.go:176 +0x5ff This can be reproduced by adding the following as the first (!) backend to your accounts.conf: [test] source = test from = test Expected behavior would be to see the error screen with the "Unknown Backend" text. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-07-03uiconfig: use pointer references to uiConfigTim Culverhouse
This patch changes references to uiConfig in function signatures and structs to be pointers. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-22binds: add folder context for message list bindsTim Culverhouse
Add option to specify folder-specific binds for message lists. The binds are layered: any existing binds in [messages] are overwritten by a more specific bind in say, [messages:folder=Drafts]. The order is currently: [messages] < [messages:account=<account>] < [messages:folder=<folder>] Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-05-31ui: check bounds before drawing dialogKoni Marti
Check bounds before drawing a dialog window to avoid a panic when resizing the terminal window. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-27refactor: refactor pgp implementationTim Culverhouse
This commit refactors the internal PGP implementation to make way for GPG integration. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-17aerc: use contextual ui styleset for tabs/composeKoni Marti
Use contextual ui styleset for tabs and compose widgets. If no account is selected, use default styleset as fallback. Fixes: https://todo.sr.ht/~rjarry/aerc/3 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-25statusline: improve status line updatingKoni Marti
Update statusline only for the selected account (to prevent other updates from different accounts to interfere). Update status when jumping/selecting/closing tabs. Fixes cosmetic regressions introduced by commit feecc09b73e2 ("statusline: make statusline folder-specific"). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-24logging: fix race condition in startupMoritz Poldrack
If a panic occurs in one of the workers, it can happen after the UI was initialised, but before the cleanup function has been registered. With this the start of the worker loops is deferred until the cleanup routine was registered. Signed-off-by: Moritz Poldrack <git@moritz.sh>
2022-03-22compose: make headerEditor focusing more reliableTim Culverhouse
Focusing header editors was hardcoded as integers which only worked with the default ui. If a user changed the UI to, for example, put CC as a field below "to", FocusSubject would focus the CC field instead of the subject. This commit reuses and modifies the function FocusEditor to generalize the focusing of header editors - which can now be called by name via FocusEditor(name string) Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-18statusline: implement per-account statusKoni Marti
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>
2022-03-18mailto: handle bcc and body fieldsTim Culverhouse
Enable handling of bcc and body fields in mailto links Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-18go vet: composite literal uses unkeyed fieldsMoritz Poldrack
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>
2022-03-18mailto: allow empty recipient fieldTim Culverhouse
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>
2022-03-14viewer: add key passthrough modekt programs
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>
2022-03-12all: fix minor issues found by staticcheckMoritz Poldrack
Signed-off-by: Moritz Poldrack <git@moritz.sh>
2022-02-25aerc: always check SelectedAccount return valueRobin Jarry
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>
2022-02-23search/filter: display in extra statusRobin Jarry
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>
2022-01-07completions: add support for completing multiple addressesParasrah
as per the discussion https://lists.sr.ht/~sircmpwn/aerc/patches/15367 this handles completions in `completer/completer.go` by enabling the completer to return a `prefix` that will be prepended to the selected completion candidate.
2022-01-07pgp: update openpgp packages (go-crypto and go-pgpmail)Koni Marti
Replaces golang.org/x/crypto with github.com/ProtonMail/go-crypto consistently and updates go-pgpmail to v0.2.0 Signed-off-by: Koni Marti <koni.marti@gmail.com>
2021-12-11binds: add account specific bindingsJonathan Bartlett
When using aerc for multiple accounts often bindings might differ slightly between accounts. For example: * Account A archives to one directory (:archive) * Account B archives to monthly directories (:archive month) Add account specific bindings to allow the user to add a "context" to a binding group using a context specifier and a regular expression. Currently the only context specifier is 'account'. The regular expression is validated against the accounts loaded from accounts.conf and the configuration fails to load if there are no matches. Contextual bindings are merged with global bindings, with contextual bindings taking precedence, when that context is active. Bindings are be configured using a generic pattern of 'view:context=regexp'. E.g.: # Globally Applicable Archiving [messages] A = :read<Enter>:archive<Enter> # Monthly Archiving for 'Mailbox' Account [messages:account=Mailbox$] A = :read<Enter>:archive month<Enter> In the above example all accounts matching the regular expression will archive in the monthly format - all others will use the global binding. Signed-off-by: Jonathan Bartlett <jonathan@jonnobrow.co.uk>
2021-11-05go.mod: change base git urlRobin Jarry
I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28view,compose: use border color to separate headers from bodyRobin Jarry
When composing a message, there is an empty fill line between the headers and the text editor. The line is printed with the default style which may cause users to assume it is part of the editor. Display the fill lines with the border color to avoid confusion. Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28bindings: prepare for more modifersRobin Jarry
Prepare to support more modifiers in key bindings. tcell has some premade ctrl-modified keys but not all keys are supported. Other keys must be explicitly checked with a modifier mask. Update the KeyStroke type to carry a modifier mask. Update code accordingly. No functional change. Link: https://github.com/gdamore/tcell/blob/master/key.go#L265-L275 Link: https://github.com/gdamore/tcell/blob/master/key.go#L384-L419 Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-01-30Get rid of the aerc.PushError(" " + $string) idiomReto Brunner
The individual callers should not be responsible for padding
2021-01-12trim <> from messageIDs when handling mailto linksReto Brunner
Co-authored-by: James Walmsley <james@fullfat-fs.co.uk>
2020-12-18update tcell to v2 and enable TrueColor supporty0ast
Also update to the tcell v2 PaletteColor api, which should keep the chosen theme of the user intact. Note, that if $TRUECOLOR is defined and a truecolor given, aerc will now stop clipping the value to one of the theme colors. Generally this is desired behaviour though.
2020-11-28fix mailto parsingReto Brunner
2020-11-14compose: use a proper header instead of a string mapReto Brunner
Prior to this commit, the composer was based on a map[string]string. While this approach was very versatile, it lead to a constant encoding / decoding of addresses and other headers. This commit switches to a different model, where the composer is based on a header. Commands which want to interact with it can simply set some defaults they would like to have. Users can overwrite them however they like. In order to get access to the functions generating / getting the msgid go-message was upgraded.
2020-08-10show error if account view creation failsReto Brunner
This can happen for example if aerc is compiled without notmuch support but the notmuch worker is requested. Pushing a status message isn't good enough, as this gets overridden pretty quickly if one has multiple accounts configured. So we show a fullscreen error instead.
2020-08-06Implement style configuration.Kalyan Sriram
Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
2020-07-30Revert "Implement style configuration."Reto Brunner
This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
2020-07-30Implement style configuration.Kalyan Sriram
Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
2020-06-09Make grid sizes dynamicJeffas
The grid used static sizes which meant that changing settings didn't have an effect on elements of the ui, notably the sidebar width. This patch makes the `Size` parameter of a cell a function which returns the `int`, allowing for dynamic sizes. A `Const` function is also included for ease of use for static sizes.
2020-05-28Revert "Add Style configuration"Drew DeVault
This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
2020-05-28Revert "Remove duration from the status methods"Drew DeVault
This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
2020-05-27Remove duration from the status methodsReto Brunner
We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
2020-05-27Add Style configurationReto Brunner
The following functionalities are added to configure aerc ui styles. - Read stylesets from file with very basic fnmatch wildcard matching - Add default styleset - Support different stylesets as part of UiConfig allowing contextual styles. - Move widgets/ui elements to use the stylesets. - Add configuration manual for the styleset
2020-05-25aerc: Refactor getpasswd dialogRay Ganardi
Previously there's a hack for showing and hiding the dialog. Change it to use channels to emulate async/await
2020-05-25feat(pgp): Show error message from pgpRay Ganardi
The error wasn't shown, making errors like wrong password being ignored and the password is prompted again.
2020-05-25feat(pgp): Add <ESC> to cancel password promptRay Ganardi
Previously there was no way to cancel the password prompt.
2020-04-24gofmt fixesDrew DeVault
2020-04-24Add postpone commandJeffas
This command uses the Postpone folder from the account config to save messages to. Messages are saved as though they were sent so have a valid 'to' recipient address and should be able to be read back in for later editing.
2020-04-24Add :choose commandRay Ganardi
Usage: *choose* -o <key> <text> <command> [-o <key> <text> <command>]... Prompts the user to choose from various options.
2020-04-23Use aerc.PushError where appropriateBen Fiedler
Forgot an unused import, to save you the hassle here is v2.
2020-03-09Add pinned tabsJeffas
This adds the commands pin-tab and unpin-tab. Once pinned a tab lives on the left of the tabstrip and has a configurable marker, defaulting to ` before its name.
2020-03-03Reduce size of the password prompt UIDrew DeVault
2020-03-03Initial support for PGP decryption & signaturesDrew DeVault
2020-03-03Add move-tab commandJeffas
2020-01-09create OriginalMail structLeszek CimaƂa
2019-12-21Show textinput completions in popoversBen Burwell
Rather than showing completions inline in the text input, show them in a popover which can be scrolled by repeatedly pressing the tab key. The selected completion can be executed by pressing enter.