aboutsummaryrefslogtreecommitdiffstats
path: root/app
Commit message (Collapse)AuthorAgeFilesLines
* compose: explicitly identify converted text/* partsRobin Jarry2024-04-131-1/+4
| | | | | | | | | | | | | | | | | | | | | When running :accept, an error is displayed on the review screen: text/calendar error: no command defined for mime/type When running :multipart text/xxx, its contents are not specified. They are regenerated every time the review screen is displayed. When running :accept, a text/calendar part is added with actual contents. Update the Part object to hold a boolean initialized when first being created. If body is nil, identify the part as "Converted" and update its contents every time the review screen is displayed. When body is not nil but contains text (e.g. when running :accept), identify the part as *not* converted and ignore the conversion step. Fixes: cbcabfafaab2 ("compose: allow writing multipart/alternative messages") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* composer: block :quit command if composer is activeVitaly Ovchinnikov2024-04-131-0/+4
| | | | | | | | Prevent aerc from quiting if there is an active composer instance, unless `:quit -f` is used. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: retry failed command directly, not over IPCJason Cox2024-04-132-7/+27
| | | | | | | | | If IPC fails the first time we try it, we know that no other aerc instance is running. When we retry, run the command directly instead of going through the current instance's own IPC server. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: use a custom prefix for dummy rootJulio B2024-04-131-1/+5
| | | | | | | | | | These messages are not really the root of the thread, and should not be displayed as such. Add a new special prefix to make them appear like the first child of a rootless thread. Signed-off-by: Julio B <julio.bacel@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* send: prevent sending if multipart conversion failedVitaly Ovchinnikov2024-04-031-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following configuration: binds.conf: [compose::review] y = :multipart text/html<Enter>:send<Enter> aerc.conf: [multipart-converters] text/html = /path/to/some/script.sh /path/to/some/script.sh: #!/bin/sh exit 10 # falls for some reason When you press `y` aerc runs `:multipart` command and although it gets an error from the converter script, the error is ignored and then the `:send` command actually sends a broken message. Add ConversionError field to Composer.Part to track multipart conversion errors. Check for conversion errors in :send, block sending if the errors are found. There is no way to skip this like missing attachment or empty subject. This is done intentionally. The user needs to update or delete the problematic part before actually sending a message. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* gpg: add pgp-self-encrypt optionBartkk2024-04-031-0/+9
| | | | | | | | | | Add an option to encrypt outgoing messages to the sender or the key specified in pgp-key-id. Implements: https://todo.sr.ht/~rjarry/aerc/237 Changelog-added: New `pgp-self-encrypt` option in `accounts.conf`. Signed-off-by: Bartkk <bartkk@bartkk.xyz> Acked-by: Robin Jarry <robin@jarry.cc>
* config: make popover dialogs configurableJohannes Thyssen Tishman2024-04-022-20/+39
| | | | | | | | | | | | Add the [ui].dialog-{position,width,height} options in aerc.conf to set the position, width and height of popover dialogs such as the one from :menu, :envelope or :attach -m relative to the main window. Changelog-added: Add `[ui].dialog-{position,width,height}` to set the position, width and height of popover dialogs. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* filters: add matching against attachment filenameBence Ferdinandy2024-03-251-0/+5
| | | | | | | | | | | | The mimetype of attachments are set by the sender, which can results in attachments getting not so useful mimetypes (e.g. application/octet-stream for a csv). Allow matching filter against filenames directly, by adding the `.filename,` and `.filename,~` syntax, similarly to headers. Changelog-added: Match filters on filename via `.filename,~<regexp> =`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* gpg: fix mime-version header positionRobin Jarry2024-03-101-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some MTAs try to normalize the case of all headers (including signed text parts headers). Unfortunately, Mime-Version can be normalized to different casing depending on the implementation (MIME- vs Mime-). Since the signature is computed on the whole part, including its header, changing the case can cause the signature to become invalid. Due to how multipart/signed messages are constructed, we need to hack around go-message writers to intercept the writing of a text part, compute its signature and write the actual message with the proper headers. Unfortunately, go-message does not allow creating a message writer that does not insert a Mime-Version header. This causes the Mime-Version header to be inserted in the wrong place: it is put inside the signed text part header instead on the top level header. Thus, included in the signed content. Make sure to remove any Mime-Version header from the signed part header. Finally, ensure that Mime-Version is set on the top-level header so that messages are compliant with RFC 2045. Fixes: https://todo.sr.ht/~rjarry/aerc/143 Link: https://github.com/emersion/go-message/issues/165 Link: https://github.com/emersion/go-pgpmail/pull/15 Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CCQRPF5EA0TF8.PEJ4AKCEGMFM%40fembook%3E Changelog-fixed: `Mime-Version` is no longer inserted in signed text parts headers. MTAs normalizing header case will not corrupt signatures anymore. Reported-by: Coco Liliace <chloe@liliace.dev> Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* templates: add visual mode indicator to TrayInfoJason Cox2024-03-041-0/+3
| | | | | | | | | | | It's useful to have some indicator of whether or not aerc is in visual mark mode. Add such an indicator to the TrayInfo available in the status line. Changelog-changed: The `TrayInfo` template variable now includes a visual mark mode indicator. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: add :query to create named notmuch dirsJason Cox2024-02-262-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current :cf command can be used to create folders for arbitrary notmuch queries. These folders use the query as their namee. In some cases, though, it's useful to give a more human-readable name. Create a new :query command to allow doing so. The :query command accepts an optional -n flag to specify a name. The remaining arguments are interpreted verbatim as a notmuch query. If no name is specified, the query itself is used as the name. For example, to create a new folder with the full thread of the current message, named by its subject, run the following command: :query -n "{{.SubjectBase}}" thread:"{mid:{{.MessageId}}}" :query could have been implemented as an additional flag to :cf. Giving a name to the created folder would make the smantics of :cf strange, though. For example, to create a named query folder, one would use :cf -n <name> <query>. This syntax feels odd; the name of the folder seems like it ought to be the positional argument of the change folder command. Alternatively, the usage could be :cf -q <query> <name>, but this feels wrong as well: the query, which is provided as a positional parameter when no name is specified, becomes a flag parameter when a name is specified. What's more, both of these potential usages add a notmuch-specific flag to an otherwise general command. Creating a new command feels cleaner. Perhaps the current query functionality of the :cf command could eventually be deprecated to remove the duplicate functionality and keep :cf limited to changing to existing folders. Changelog-added: Create notmuch named queries with the `:query` command. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: allow configuring default splitRobin Jarry2024-02-221-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new setting to configure the default split layout for message list tabs. The syntax is a bit different from the :split and :vsplit commands since it needs to convey the direction in the value as well. I didn't reuse split/vsplit since they are a bit confusing when used in a configuration file. The syntax is as follows: message-list-split = [<direction>] <size> The direction is optional and defaults to horizontal. The size is the number of terminal cells that will be used to display the message list. All these examples are equivalent: message-list-split = horiz 12 message-list-split = h 12 message-list-split = 12 Same idea for vertical splits: message-list-split = vertical 120 message-list-split = vert 120 message-list-split = v 120 Both :split and :vsplit commands remain usable as before. The configuration options only affect the initial layout at startup. Add config.SPLIT_* constants and sanitize AccountView.{Split,Vsplit} methods. Changelog-added: Configure default message list `:split` or `:vsplit` on startup with `message-list-split` in `aerc.conf`. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* status: make message counts available in templatesJason Cox2024-02-191-0/+1
| | | | | | | | | Make .Recent, .Unread, .Exists, and .RUE work in statusline templates. Changelog-added: Message counts are available in statusline templates. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* log: move package to libRobin Jarry2024-02-1412-12/+12
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* lib: add function to obtain Message-ID hostnameKarel Balej2024-02-121-21/+10
| | | | | | | | | Make the function already present in app/compose.go reusable while also changing its signature for it not to require involvement of a Composer instance. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: use start with appropriate sizeTim Culverhouse2024-02-121-1/+2
| | | | | | | | | Use the StartWithSize method to start the terminal with the appropriate size. This prevents multiple WINCH signals from being sent to the pty at startup Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* vaxis: update to v0.7.2 and update ansi parserTim Culverhouse2024-02-121-10/+16
| | | | | | | | | | | | Update Vaxis to v0.7.2 to gain performance improvements and StyledString parsing. The Vaxis parser fully accounts for the terminal's capability to display wide characters. Use the Vaxis StyledString parser to parse and style ansi-encoded strings. Remove unneeded code and tests. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mouse: use vaxis mouse eventsTim Culverhouse2024-02-127-39/+30
| | | | | | | Replace all tcell.EventMouse events with vaxis mouse events Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* paste: use vaxis paste eventsTim Culverhouse2024-02-121-6/+8
| | | | | | | Replace tcell paste events with vaxis paste events Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: replace tcell-term with vaxis terminalTim Culverhouse2024-02-121-41/+20
| | | | | | | | Replace tcell terminal with the vaxis terminal. The vaxis terminal is a port of tcell term. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: use vaxis style everywhereTim Culverhouse2024-02-1210-26/+23
| | | | | | | Replace all tcell.Style objects with vaxis.Style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: replace tcell keys with vaxis keysTim Culverhouse2024-02-127-70/+98
| | | | | | | Replace all instances of tcell key usage with vaxis keys Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* fill: replace tcell.Style with vaxis.StyleTim Culverhouse2024-02-124-6/+7
| | | | | | | Replace the Fill implementation with vaxis style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: remove screen and viewportsTim Culverhouse2024-02-121-7/+5
| | | | | | | | Remove references to tcell.Screen or views.Viewports. Convert Contexts and the core UI struct to use Vaxis objects only. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: change event interfaces to vaxis eventsTim Culverhouse2024-02-1214-27/+37
| | | | | | | | | | Modify the function signature of Event and MouseEvent interfaces to accept vaxis events. Note that because a vaxis event is an empty interface, the implementations are not affected and the events are delivered as they were before Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: implement inline image viewingTim Culverhouse2024-02-121-2/+99
| | | | | | | | | | | | | | | | | Implement inline image viewing for jpeg, png, bmp, tiff, and webp formats. When a user has no configured image filter and the image is supported and the terminal has either sixel or kitty image protocol support, the image will be displayed in the message viewer. Always clear the screen before each draw. This call is necessary in vaxis to allow for images to be cleared properly between renders. There is no performance impact: the call only resets each cell to a blank cell, and aerc will redraw each one already. Changelog-added: Inline image previews when no filter is defined for `image/*` and the terminal supports it. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: add alignKoni Marti2024-02-112-0/+41
| | | | | | | | | | | | | | | | | | | | | Add a new :align command that aligns the selected message vertically at the top, center, or bottom of the message list. The command requires a position argument that can either be: "top", "center", or "bottom". Create the following default keybinds: zz = :align center<Enter> zt = :align top<Enter> zb = :align bottom<Enter> Changelog-added: Add new `:align` command to align the selected message at the top, center, or bottom of the message list. Suggested-by: Ángel Castañeda <angel@acsq.me> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: add msglist-scroll-offsetKoni Marti2024-02-111-0/+2
| | | | | | | | | | | | Add the [ui].msglist-scroll-offset option in aerc.conf to set the scroll offset in number of lines from the top and bottom of the message list. Changelog-added: Add `[ui].msglist-scroll-offset` option to set a scroll offset for the message list. Suggested-by: Ángel Castañeda <angel@acsq.me> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* scrollable: rewrite with scroll offsetKoni Marti2024-02-111-15/+25
| | | | | | | | | | | Rewrite the scrolling logic to consider a scroll offset. Ensure correct lower and upper bounds of the scroll variable. Cap offset at half of the screen height. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* app: add keybinds annotation when printing bindingsKoni Marti2024-02-111-3/+11
| | | | | | | | | | | Add annotations in square brackets in app.HumanReadableBindings() which translates the keyinds to strings for the ':help keys' command. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: show annotations on the review screenKoni Marti2024-02-111-19/+35
| | | | | | | | | | | | | | | Customize annotations on the review screen. Annotations will overwrite the default descriptions. Replace the [][]string construct with a named struct for better readability. Fixes: https://todo.sr.ht/~rjarry/aerc/118 Changelog-deprecated: Built-in descriptions for the default keybinds shown on the review screen will be deprecated in a future release. Descriptions can be added to those keybinds with inline comments in binds.conf. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: fix deadlock when editor errors after :reply -cRobin Jarry2024-01-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the message viewer is open and running :reply -c, if the editor exits with an error (e.g. vim :cq), the compose tab is not closed and aerc does not register input anymore. This happens because the composer is closed twice. Once explicitly, and a second time by RemoveTab. This causes to open two viewers on the same message at the same time. Here is the deadlock stack trace: goroutine 149 [sync.Mutex.Lock]: runtime.gopark() runtime/proc.go:398 ... sync.(*Mutex).Lock(...) sync/mutex.go:90 git.sr.ht/~rjarry/aerc/app.(*Composer).Show() git.sr.ht/~rjarry/aerc/app/compose.go:793 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).selectPriv() git.sr.ht/~rjarry/aerc/lib/ui/tab.go:171 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).Add() git.sr.ht/~rjarry/aerc/lib/ui/tab.go:75 git.sr.ht/~rjarry/aerc/app.(*Aerc).NewTab() git.sr.ht/~rjarry/aerc/app/aerc.go:481 git.sr.ht/~rjarry/aerc/app.NewTab(...) git.sr.ht/~rjarry/aerc/app/app.go:60 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute.func1() git.sr.ht/~rjarry/aerc/commands/account/view.go:71 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView.func1() git.sr.ht/~rjarry/aerc/lib/messageview.go:79 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView() git.sr.ht/~rjarry/aerc/lib/messageview.go:123 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute() git.sr.ht/~rjarry/aerc/commands/account/view.go:52 git.sr.ht/~rjarry/aerc/commands/msg.reply.Execute.func1.1() git.sr.ht/~rjarry/aerc/commands/msg/reply.go:191 git.sr.ht/~rjarry/aerc/app.(*Composer).Close() git.sr.ht/~rjarry/aerc/app/compose.go:714 git.sr.ht/~rjarry/aerc/app.(*Composer).termClosed() git.sr.ht/~rjarry/aerc/app/compose.go:1189 git.sr.ht/~rjarry/aerc/app.(*Terminal).closeErr() git.sr.ht/~rjarry/aerc/app/terminal.go:69 git.sr.ht/~rjarry/aerc/app.(*Terminal).Close(...) git.sr.ht/~rjarry/aerc/app/terminal.go:46 git.sr.ht/~rjarry/aerc/app.(*Terminal).HandleEvent() git.sr.ht/~rjarry/aerc/app/terminal.go:174 git.sr.ht/~rockorager/tcell-term.(*VT).Start.func1() git.sr.ht/~rockorager/tcell-term@v0.10.0/vt.go:175 created by git.sr.ht/~rockorager/tcell-term.(*VT).Start in goroutine 1 git.sr.ht/~rockorager/tcell-term@v0.10.0/vt.go:165 +0x38d Fixes: https://todo.sr.ht/~rjarry/aerc/216 Reported-by: Karel Balej <balejk@matfyz.cz> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Karel Balej <balejk@matfyz.cz>
* listbox: send some key events to textinputKoni Marti2024-01-291-20/+13
| | | | | | | | | | | | Send some key events directly to the textinput widget when the filter line is shown. There's no need to have duplicated code in listbox and textinput for the same keys, e.g. CtrlW. This also fixes a panic when CtrlW is used on the filter line. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* app: define two dialog constructorsKoni Marti2024-01-291-0/+28
| | | | | | | | | | | | | Define two new constructor functions for the popup dialog. DefaultDialog() creates a dialog that spans half of the screen, whereas the LargeDialog() covers three-quarter of the screen. If a dialog widget has more specific size requirements, custom window position and window height functions can be used with NewDialog(). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* listbox: add external text filter functionKoni Marti2024-01-291-11/+26
| | | | | | | | | | | Set an external filter function to use in the filtering operation of the listbox widget. This allows us to use commands.FilterList without an import cycle conflict. commands.FilterList comes with fuzzy completion, too. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* listbox: use tab key to cycle through listKoni Marti2024-01-291-2/+2
| | | | | | | | | Use tab key to cycle forward and backtab to cycle backward through the selection in the listbox widget. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: allow thread arrow customizationinwit2024-01-292-20/+75
| | | | | | | | | | | | | | | | | | The thread prefix appearance is inspired by mutt and has been regarded by some as too wide and not very aesthetically pleasing. Nevertheless, it has some technical limitations, like not being able to show if a thread is folded. Allow for full customisation of the thread prefix by introducing 14 new config options. Dirlist is not affected. Changelog-added: Thread arrow prefixes are now fully configurable. Co-authored-by: Robin Jarry <robin@jarry.cc> Signed-off-by: inwit <inwit@sindominio.net> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* bindings: do not systematically trigger completionRobin Jarry2024-01-271-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When simulating keystrokes of a binding, the command completion is disabled momentarily for performance reasons and re-enabled once the sequence is finished. See commit 055c6dc6604f ("exline: don't draw completions for keybinds") for more details. Since commit 0b0095eeadaf ("complete: allow disabling automatic completion"), it is possible to only rely on explicit keystrokes to display the completion menu. With the default settings, if a key sequence contains more than [ui].completion-min-chars, it should trigger completion after [ui].completion-delay. But since the completion was disabled when the keystrokes are input, it does not trigger the completion. To work around this, an artificial <Tab> keystroke was added at the end of the sequence to force trigger the completion menu. For more details, see commit 04869bd2a39a ("aerc: fix popover menu regression"). The workaround that was added, along with commit b3dc63d69c14 ("complete: only display popover for more than one choice"), forces the completion when there is a single choice. Completely ignoring [ui].completion-min-chars = manual. Only explicitly trigger the completion if the completion key was seen in the keystroke sequence or if completion-min-chars is not set to manual. Use the correct completion key and not hard code Tab. Fixes: 0b0095eeadaf ("complete: allow disabling automatic completion") Fixes: https://todo.sr.ht/~rjarry/aerc/210 References: https://todo.sr.ht/~rjarry/aerc/104 Cc: Skejg <grolleman@zoho.com> Reported-by: Karel Balej <balejk@matfyz.cz> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Karel Balej <balejk@matfyz.cz> Tested-by: Koni Marti <koni.marti@gmail.com>
* tabs: optimize switching by offsetsdelitako2024-01-262-0/+5
| | | | | | | | | | | | | | | | | I imagine no sane user requires aerc to correctly handle commands like `:next-tab 1000000000`, but I tried anyway and it froze aerc while also eating up many GBs of system memory. This behavior is not ideal, so I improved it. This commit adds functions for selecting a tab at an offset from the currently-selected tab and changes the next-tab, prev-tab, and change-tab commands to use these functions instead of looping. Signed-off-by: delitako <delitako@delitako.xyz> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: don't attach key when removing signatureThomas Böhler2024-01-261-2/+0
| | | | | | | | | | | | | | If pgp-attach-key is set in accounts.conf, the key is detached with :detach and the signature removed with :sign, the key will be attached again. When :sign is called again two keys will be attached instead of one. Fix this by not attaching a key if it cannot be detached. Fixes: 9d90b70b4edf ("compose: refactor attachment handling") Signed-off-by: Thomas Böhler <witcher@wiredspace.de> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: allow automatic attachment of signing keyRobin Jarry2024-01-251-0/+10
| | | | | | | | | | | | | | | | | | Add a new pgp-attach-key boolean setting in accounts.conf. When set to true, enabling message signing (either automatically via pgp-auto-sign or manually with :sign) will imply attaching the (public) key that will be used to sign the message before sending. The automatically attached key can be unattached like any other attachment with :detach. Implements: https://todo.sr.ht/~rjarry/aerc/207 Changelog-added: Automatically attach signing key with `pgp-attach-key` in `accounts.conf`. Requested-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
* compose: ensure rfc2045 compliant mime messageKoni Marti2024-01-191-0/+8
| | | | | | | | | | | | Ensure that the encrypted and/or signed messages contain a correct MIME-Version header field at the top level of the message in compliance with RFC2045 Section 4. Link: https://datatracker.ietf.org/doc/html/rfc2045#section-4 Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3C1704071512-sup-2798%40honeycomb%3E Reported-by: Dan Callaghan <djc@djc.id.au> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: move signature from compose to templatesBence Ferdinandy2024-01-081-91/+0
| | | | | | | | | | | | | | | | Currently, when composing a new message, everything is read from the template files, except the signature, which is added directly in the compose code. Add a new template variable {{.Signature}}, by moving the logic of reading signature from command or file from compose to templates. Update the various default template files to preserve the original placement of signatures. Users using the default templates should not notice the change. Users with custom compose templates will need to update their templates with {{.Signature}}. Changelog-changed: Signature placement is now controlled via the `{{.Signature}}` template variable and not hardcoded. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: refactor tree buildingMoritz Poldrack2023-12-301-35/+26
| | | | | | | | | | | | Our way of building trees seems absurd: generate a list of prefixes, reverse it, and trim the first element. Change it so the string is built back to front and define the arrows beforehand so they are easier to configure. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* patch/list: add list sub-cmdKoni Marti2023-12-303-17/+8
| | | | | | | | | Implement the :patch list command. List the the current project and add a flag to list all saved projects. Use the pager to display the data and extract the pager commands and move them into the config package. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* cf: allow changing folder of another accountRobin Jarry2023-12-051-0/+8
| | | | | | | | | | | | | | Add a new -a flag to :cf. When specified, an account name is required before the folder name and the focus will be changed to the corresponding account tab before changing folders. If the target folder does not exist, an explicit error will be reported. Changelog-added: Change to a folder of another account with `:cf -a <account> <folder>`. Signed-off-by: Robin Jarry <robin@jarry.cc> Co-authored-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* dirtree: prevent folder selection when archivingKoni Marti2023-12-011-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent an unwanted folder selection in the directory tree when archiving. A previous fix (commit 0be135a3) introduced a regression which caused the directory tree to select the folder for which a CreateDirectory message returned successfully. Since the :archive command will issue a CreateDirectory message in every operation, the directory tree will thus erroneously select the target archive directory. However, the functionality to select a newly created folder by the :mkdir command is actually correct and should be kept since this corresponds to the regular directory list behavior. Another quirk that is addressed is caused by the rebuilding of the directory tree when the underyling directories change. In that case, the ui.DirListCollapse setting would overwrite the user changes. Therefore, only apply the ui.DirListCollapse setting at the first time of building the directory tree. Fixes: 0be135a38186 ("dirtree: fix jumping folders") Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* dirtree: fix jumping foldersKoni Marti2023-11-241-3/+5
| | | | | | | | | | | Fix jumping folders in the directory structure. Fixes: a35d9bab ("rmdir: ensure proper sequence of operations") Reported-by: inwit <inwit@sindominio.net> Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* term: ensure cursor is hidden before closingRobin Jarry2023-11-241-0/+3
| | | | | | | | | | | When running a terminal in a dialog that is closed before the terminal has had a chance of being redrawn, the cursor may be left visible. Make sure to hide the cursor in the close routine. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Jason Cox <me@jasoncarloscox.com>
* dirtree: add custom virtual directory roleKoni Marti2023-11-231-0/+24
| | | | | | | | | Add a new directory role to indicate virtual nodes in the directory tree. This allows to style the virtual nodes differently and apply different behaviors in some commands (i.e. rmdir). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>