aboutsummaryrefslogtreecommitdiffstats
path: root/app/aerc.go
Commit message (Collapse)AuthorAgeFilesLines
* binds: allow per folder sections for the message viewerRobin Jarry2024-06-231-2/+4
| | | | | | | | | | Allow creating [view:folder=FooBar] in binds.conf. Changelog-added: Per folder key bindings can now be defined for the message viewer. Requested-by: Matěj Cepl <mcepl@cepl.eu> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Matěj Cepl <mcepl@cepl.eu>
* app: make aerc satisfy the Beeper interface againKarel Balej2024-05-091-5/+3
| | | | | | | | | | | | | | During the Vaxis switchover, the Beeper interface was changed because Vaxis' Bell() function does not return error. However the corresponding change was not made on aerc making it not satisfy this interface and thus the DrawableInteractiveBeeper interface. This lead to the Bell function not getting registered making aerc unable to ring the terminal bell. Fix this. Fixes: 0fd5f4115792 ("ui: initialize vaxis directly, drop tcell.Screen initialization") Signed-off-by: Karel Balej <balejk@matfyz.cz> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ipc: retry failed command directly, not over IPCJason Cox2024-04-131-7/+26
| | | | | | | | | 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>
* config: make popover dialogs configurableJohannes Thyssen Tishman2024-04-021-3/+4
| | | | | | | | | | | | 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>
* log: move package to libRobin Jarry2024-02-141-1/+1
| | | | | | | 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>
* mouse: use vaxis mouse eventsTim Culverhouse2024-02-121-4/+2
| | | | | | | 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>
* aerc: replace tcell keys with vaxis keysTim Culverhouse2024-02-121-19/+35
| | | | | | | 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-121-2/+2
| | | | | | | Replace the Fill implementation with vaxis style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: change event interfaces to vaxis eventsTim Culverhouse2024-02-121-1/+2
| | | | | | | | | | 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>
* 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>
* 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-261-0/+4
| | | | | | | | | | | | | | | | | 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>
* patch/list: add list sub-cmdKoni Marti2023-12-301-4/+6
| | | | | | | | | 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>
* binds: folder-specific bindings for composerVitaly Ovchinnikov2023-11-021-3/+5
| | | | | | | | | Add folder-specific bindings for composer, so custom binginds might be specified for a composer opened in a given folder. Changlelog-Added: `[compose::editor:folder=$name]` binding context. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: pass raw command line down to template evaluationRobin Jarry2023-10-281-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | Some commands need to invoke others and/or run shell commands. For this, we need the raw command line as entered by the user. Pass it down the call chain just before it is split to invoke the command Execute method. Remove unit tests for the template expand() test which does have any added value now that it is performed on a single string without any quote juggling. Update all code to handle a single string instead of a list of arguments. Introduce a new dependency on git.sr.ht/~rjarry/go-opt to deal with shell splitting. This is in preparation for using opt.ArgsToStruct to parse arguments for all aerc commands. There should be no functional change after this patch. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* ui: export global functionsRobin Jarry2023-10-111-5/+0
| | | | | | | | | | | | | There is no need for an UI object. The Aerc.ui field is unused. And there is a single instance of it anyway. Move the object's public fields as global variables and change methods to public functions. This makes the code cleaner and removes boilerplate. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* app: fix nil pointer dereference on startupRobin Jarry2023-10-111-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following crash on startup: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x9e2314] goroutine 1 [running]: git.sr.ht/~rjarry/aerc/log.PanicHandler() git.sr.ht/~rjarry/aerc/log/panic-logger.go:51 +0x70f panic({0xae95a0, 0x119f9b0}) runtime/panic.go:890 +0x263 git.sr.ht/~rjarry/aerc/app.(*Aerc).SelectedAccount(0x8503cdd28?) git.sr.ht/~rjarry/aerc/app/aerc.go:384 +0x14 git.sr.ht/~rjarry/aerc/app.SelectedAccount(...) git.sr.ht/~rjarry/aerc/app/app.go:44 git.sr.ht/~rjarry/aerc/app.(*AccountView).isSelected(...) git.sr.ht/~rjarry/aerc/app/account.go:225 git.sr.ht/~rjarry/aerc/app.(*AccountView).UpdateStatus(0x850364380) git.sr.ht/~rjarry/aerc/app/account.go:127 +0x28 git.sr.ht/~rjarry/aerc/app.(*AccountView).SetStatus(0x850364380, {0x850243a50, 0x1, 0x0?}) git.sr.ht/~rjarry/aerc/app/account.go:123 +0x94 git.sr.ht/~rjarry/aerc/app.NewAccountView(0x8503d38c0, 0x85041bf80) git.sr.ht/~rjarry/aerc/app/account.go:111 +0x573 git.sr.ht/~rjarry/aerc/app.NewAerc({0xcab0c0?, 0x11fa3c8}, 0x850433860, 0xbf3040, {0xca75e8?, 0x11ca800}, 0x0?) git.sr.ht/~rjarry/aerc/app/aerc.go:91 +0x6ce git.sr.ht/~rjarry/aerc/app.Init(...) git.sr.ht/~rjarry/aerc/app/app.go:24 main.main() git.sr.ht/~rjarry/aerc/main.go:242 +0x52e There was two things very wrong: - Access of the global aerc pointer before it was initialized. - The host field of AccountView was left there and still accessed but never initialized. Replace the global aerc pointer with a real struct value. Update code accordingly. Remove the AccountView.host field which is now useless. Reported-by: Jens Grassel <jens@wegtam.com> Reported-by: Matěj Cepl <mcepl@cepl.eu> Fixes: bc176bd61ba7 ("app: export global functions") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* app: export global functionsRobin Jarry2023-10-101-9/+7
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-101-0/+908
This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>