aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
Commit message (Collapse)AuthorAgeFilesLines
* filters: append well known dirs to exec PATHRobin Jarry2022-10-161-0/+6
| | | | | | | | | | | | | | | | | | | To allow referencing built-in filters without hard coding a path during installation, append the following folders to the exec PATH when running the filter commands: ~/.config/aerc/filters ~/.local/share/aerc/filters $PREFIX/share/aerc/filters /usr/share/aerc/filters If a filter script has the same name than a command in the default exec PATH, it will not shadow it. In that edge case, the absolute path to the filter script must be specified. Suggested-by: Teo Luppi <me@luppi.uk> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* compose: don't lock call to composer.grid.MouseEventTim Culverhouse2022-10-121-1/+3
| | | | | | | | | | | | | | | | The MouseEvent method of the composer passes on the mouse event to it's underlying grid while the composer is locked. The underlying grid then passes on the mouse event to child objects of the grid, which are referenced via fields of the composer (c.editor is a field in composer but a child of c.grid, for example). When the grid attempts to pass on the mouse event, it is referencing a pointer which is locked, and a deadlock occurs due to the original lock in composer.MouseEvent. Unlock before calling the grid.MouseEvent, and lock the composer again after it is called. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mailto: allow attaching of filesMoritz Poldrack2022-10-121-0/+10
| | | | | | | | | | | Some programs like Skanpage allow sharing files via email and attaching them automatically from the mailto: link. This patch introduces parsing of the attach query argument in mailto links and attaches the listed files. A potential file:// URL has it's prefix removed. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* invalidatable: cleanup dead codeTim Culverhouse2022-10-1216-128/+27
| | | | | | | | Remove invalidatable type and all associated calls. All items can directly invalidate the UI. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: avoid deadlock when adding new headerRobin Jarry2022-10-111-1/+5
| | | | | | | | | | | | AddEditor acquires the lock and calls FocusEditor which also attempts to acquire it. Since the lock is not re-entrant, it ends in deadlock. Add an internal focusEditor fonction that does not acquire the lock. Fixes: bf2bf8c242cb ("compose: prevent out of bounds access") Reported-by: Moritz Poldrack <moritz@poldrack.dev> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
* compose: fix mouse focus of header editorsRobin Jarry2022-10-111-0/+6
| | | | | | | | | The algorithm is broken, there may be more than one header editor with focused=true. Reset the focused flag before forwarding the mouse event to the composer grid. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* terminal: use Invalidate and QueueRedrawTim Culverhouse2022-10-071-14/+2
| | | | | | | | | | | | | | | | | | | The terminal widget uses it's own redraw logic to improve performance. With the addition of a main event loop, the redraw logic can happen in the main loop via the standard Invalidate logic. Use the Invalidate method to mark aerc invalid, and immediately trigger a redraw with ui.QueueRedraw. The follow up call to QueueRedraw is needed because the terminal update happens in a separate goroutine. This can result in the main event loop finishing it's process of the current event, redrawing the screen, and the terminal having additional updates to be drawn. This fixes race conditions by drawing and calling screen.Show in a separate goroutine. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: use single event loopTim Culverhouse2022-10-074-34/+19
| | | | | | | | | Combine tcell events with WorkerMessages to better synchronize state with IO and UI. Remove Tick loop for rendering. Use events to trigger renders. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: avoid double lock in MouseEventTim Culverhouse2022-10-051-2/+5
| | | | | | | | | | | | | The MouseEvent locks the composer, and also calls FocusEditor which attempts to lock the composer. This results in a deadlock. No need to call FocusEditor which takes a name as parameter and needs to iterate over all editors to find the correct one. We already have the headerEditor object, use it directly. Fixes: bf2bf8c242cb ("compose: prevent out of bounds access") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
* viewer: option to not mark message as seenKoni Marti2022-10-041-2/+2
| | | | | | | | | | | | | | | | | Add option to open a message in the message viewer without setting the seen flag. Enables the message viewer to be used as a preview pane without changing the message flags unintentionally. Before, the message viewer would set the seen flag by default. The IMAP backend will now always fetch the message body with the peek option enabled (same as we fetch the headers). An "auto-mark-read" option is added to the ui config which is set to true by default. If set the false, the seen flag is not set by the message viewer. Co-authored-by: "James Cook" <falsifian@falsifian.org> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* bindings: properly check for exKey keystrokesTim Culverhouse2022-10-031-1/+9
| | | | | | | | | | | | | | | | | | | | | When checking for an exKey, aerc inspects the key and the rune of the event vs the exkey binding. Runes should only be inspected if the key is a tcell.KeyRune. Some Ctrl-[:alpha:] keys report a rune in tcell, but aerc does not have these bound to the keystroke definition. Only <C-x> has a rune bound, and is one of the very few <C-> keys that can actually be bound to exKey Only compare the Rune field if the key is of type KeyRune. Otherwise, compare the Key. Also compare any modifiers with the keystroke/key event. These changes allow for any control or alt key combination to be bound to the exkey. Update documentaiton to reflect that the default keybind is ':', and not <semicolon> Fixes: https://todo.sr.ht/~rjarry/aerc/67 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: substitute %w for %vKoni Marti2022-10-022-2/+2
| | | | | | | | | | | | | | | | Subsitute the format specifier %w for %v in the logging facility. The logging functions use a fmt.Sprintf call behind the scene which does not recognize %w. %w should be used in fmt.Errorf when you want to wrap errors. Hence, the log entries that use %w are improperly formatted like this: ERROR 2022/10/02 09:13:57.724529 worker.go:439: could not get message info %!w(*fmt.wrapError=&{could not get structure: [snip] }) ^ Links: https://go.dev/blog/go1.13-errors Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* terminal: fix race conditions on access to cmdTim Culverhouse2022-10-021-35/+11
| | | | | | | | | | | | | | | | Upgrade tcell-term to v0.2.0 Use Start method from tcell-term. This prevents aerc from needing to wait until the command has started to continue. The tcell-term start method blocks until the command is started, similar to cmd.Start. By doing so, we prevent a race condition between aerc and tcell-term on access to cmd.Process. Remove cleanup of cmd, this is all already handled by tcell-term when Close is called. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: remove invalidate methodTim Culverhouse2022-09-291-5/+1
| | | | | | | | | | The terminal widget has two invalidation methods, one exported and one private. The private one does nothing special. Remove the private method and only use the exported method. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirlist: prevent race condition on accessing uiconfigTim Culverhouse2022-09-291-0/+4
| | | | | | | Prevent a race condition when accessing UI Config maps Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: stop checkmail if there are pending actionskt programs2022-09-291-6/+19
| | | | | | | | | | | | | Pass message containing remaining directories to check. Account widget will recursively call CheckMail with the remaining directories until a Done message is returned. Only needed for IMAP worker as other workers run check-mail-cmd in a separate goroutine. Suggested-By: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: kt programs <ktprograms@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* compose: prevent out of bounds accessRobin Jarry2022-09-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following panic, seen while switching accounts: runtime error: index out of range [4] with length 4 goroutine 6 [running]: git.sr.ht/~rjarry/aerc/widgets.(*Composer).Focus(0xc005cfbe30?, 0x40?) git.sr.ht/~rjarry/aerc/widgets/compose.go:618 +0x51 git.sr.ht/~rjarry/aerc/widgets.(*Aerc).focus(0xc00034c000, {0x0?, 0x0}) git.sr.ht/~rjarry/aerc/widgets/aerc.go:568 +0xec git.sr.ht/~rjarry/aerc/widgets.(*Aerc).BeginExCommand.func2() git.sr.ht/~rjarry/aerc/widgets/aerc.go:590 +0x4c git.sr.ht/~rjarry/aerc/widgets.(*ExLine).Event(0xc009453860, {0xbb6820?, 0xc009baa320?}) git.sr.ht/~rjarry/aerc/widgets/exline.go:81 +0xbc git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Event(0xc009ab1950?, {0xbb6820?, 0xc009baa320?}) git.sr.ht/~rjarry/aerc/widgets/aerc.go:285 +0x470 git.sr.ht/~rjarry/aerc/lib/ui.(*UI).ProcessEvents(0xc000327540) git.sr.ht/~rjarry/aerc/lib/ui/ui.go:117 +0x202 created by main.main git.sr.ht/~rjarry/aerc/aerc.go:244 +0x94c Protect Composer.editable and Composer.focus with a mutex. Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* notmuch: move logic for dynamic folders to backendKoni Marti2022-09-291-13/+0
| | | | | | | | | | | | | | | Moves logic for creating dynamic folders from the dirlist widget to the backend. Since dynamic folders are notmuch-specific, the notmuch backend should be responsible for correctly setting up those folders. It does that by sending two DirectoryInfos: the first to create the message store, the second to fetch the directory content. This approach also fixes a deadlock introduced by 716ade8968715 ("worker: lock access to callback maps"). Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* exline: don't draw completions for keybindsTim Culverhouse2022-09-292-3/+20
| | | | | | | | | | | | | | | | | | | The exline widget works by matching actual keystrokes to a map of keybinds, and if a match is found sending simulated keystrokes through aerc. This has the effect of aerc thinking we are actually typing in the expanded command, and aerc attempts to draw the completions. This results in even basic navigation having two screen draws: For example, pressing 'j' to select the next message (:next), draws once for the initial key event and state change, and again after the completion debounce timer. Disable tab completion while aerc is simulating keystrokes. If the exline still has focus after simulating keystrokes, restore tab completion. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
* checkmail: protect access to acct.checkingmailTim Culverhouse2022-09-261-0/+6
| | | | | | | | | A data race exists between the timer goroutine and the main goroutine for checking / setting the status of acct.checkingmail. Protect access to this value with a mutex Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirlist: avoid race from accessing ui config in Select debounceTim Culverhouse2022-09-261-1/+2
| | | | | Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: prevent draw loop when unfocusedTim Culverhouse2022-09-261-0/+3
| | | | | | | | | | If a :term is open and aerc is focused on another tab, it is possible for the :term to redraw itself to the screen. Only allow terminal to redraw itself when it is focused. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* grid: remove unused method ChildrenTim Culverhouse2022-09-202-8/+0
| | | | | | | | | | | The grid method Children returns the children of a grid, and is never used. The function is reimplemented in both aerc.go and account.go, also never called. Remove these unused methods. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirlist: don't invalidate on spinner.InvalidateTim Culverhouse2022-09-201-3/+0
| | | | | | | | The dirlist is invalidated explicitly after the spinner is stopped. For simplicitly, don't invalidate on spinner.Invalidate. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* switch: add -n and -p flags for relative switchRobin Jarry2022-09-201-0/+36
| | | | | | | | | Allow switching to next or previous account with switch-account -n and switch-account -p, respectively. By default, these are bound to Alt-n and Alt-p. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* composer: restructure to implement account switchingKoni Marti2022-09-192-30/+106
| | | | | | | | | Extract some functionality of the composer constructor into a account-specific setup function that can be used to implement account switching. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: fix segfault when closing viewerRobin Jarry2022-09-191-1/+0
| | | | | | | | | | | | | | | | | | | There is a race between PartViewer.Cleanup and PartViewer.Draw. pv.term may be not nil in Draw and Cleanup() may set it to nil before pv.term.Draw() is called, causing an invalid memory access: [signal SIGSEGV: segmentation violation code=0x1 addr=0x29 pc=0x9413b8] git.sr.ht/~rjarry/aerc/widgets.(*Terminal).Draw(0x0?, 0x0?) git.sr.ht/~rjarry/aerc/widgets/terminal.go:97 +0x18 git.sr.ht/~rjarry/aerc/widgets.(*PartViewer).Draw(0xc00012a540, 0xc0026ea690) git.sr.ht/~rjarry/aerc/widgets/msgviewer.go:862 +0x2fd There is no need to reset term to nil. Fixes: 77f69501d648 ("msgviewer: properly close embedded terminal") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* terminal: don't invalidate on EventWidgetContentTim Culverhouse2022-09-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The terminal widget uses it's own internal event handler to redraw itself for improved performance. The event handler draws, updates the screen, and invalidates. The last invalidate is redundant: Invalidating has the result of telling aerc to redraw the screen. A race condition can occur where an event is emitted from the terminal and the terminal is closed before the event is handled. This results in handling the event after the terminal is closed, and a panic: panic: Attempted to invalidate unknown cell goroutine 54685 [running]: git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).cellInvalidated(0xc00b0a34a0, {0xbb8f10?, 0xc00360cd80}) git.sr.ht/~rjarry/aerc/lib/ui/grid.go:287 +0x175 git.sr.ht/~rjarry/aerc/lib/ui.(*Invalidatable).DoInvalidate(0xc0002e7900?, {0xbb8f10?, 0xc00360cd80?}) git.sr.ht/~rjarry/aerc/lib/ui/invalidatable.go:22 +0x82 git.sr.ht/~rjarry/aerc/widgets.(*Terminal).invalidate(...) git.sr.ht/~rjarry/aerc/widgets/terminal.go:93 git.sr.ht/~rjarry/aerc/widgets.(*Terminal).HandleEvent(0xc00360cd80, {0xbb4ba0?, 0xc006022690?}) git.sr.ht/~rjarry/aerc/widgets/terminal.go:192 +0xd2 github.com/gdamore/tcell/v2/views.(*WidgetWatchers).PostEvent(...) github.com/gdamore/tcell/v2@v2.5.3/views/widget.go:113 github.com/gdamore/tcell/v2/views.(*WidgetWatchers).PostEventWidgetContent(0xc0001b9360, {0xbbc950?, 0xc0001b9320}) github.com/gdamore/tcell/v2@v2.5.3/views/widget.go:123 +0x12b git.sr.ht/~rockorager/tcell-term.(*Terminal).run.func1() git.sr.ht/~rockorager/tcell-term@v0.1.0/terminal.go:117 +0x9d created by git.sr.ht/~rockorager/tcell-term.(*Terminal).run git.sr.ht/~rockorager/tcell-term@v0.1.0/terminal.go:104 +0x110 Don't invalidate on EventWidgetContent. The terminal already handles drawing and updating the tcell Screen internally. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: protect calls to terminal methods throughout aercTim Culverhouse2022-09-192-1/+6
| | | | | | | | | | | | | | A race condition can occur when a PartViewer is closing and also working on a draw. The closing process sets the terminal to nil, which will create a panic. This can be tested in development by setting the timer in the main aerc tick loop to something very low (1 ms for example). One other unprotected call to terminal exists in the composer widget. Check that the terminal is not nil before calling methods on it. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: improve mouse supportTim Culverhouse2022-09-152-12/+11
| | | | | | | | Improve terminal mouse support by forwarding mouse events to the terminal widget. Clicking and dragging are supported. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: properly close embedded terminalRobin Jarry2022-09-151-6/+3
| | | | | | | | | | | | | | | | | | | The terminal widget already handles most boring stuff: unwatch terminal events, kill the underlying process, wait for it to exit, etc. Call the Close() method and be done with it. This avoids issues where the embedded terminal widget is destroyed but the pager process does not know about it and dies in agony, writing over aerc's UI: Vim: Caught deadly signal HUP Also, it may avoid leaving child processes as zombies without giving them a proper burial. Reported-by: skejg Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
* terminal: check for context before calling it's methodsTim Culverhouse2022-09-151-3/+7
| | | | | | | | The terminal widget internally uses several context methods. Check that context is not nil before calling any method to prevent panics. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* term: add bracketed paste supportTim Culverhouse2022-09-141-0/+22
| | | | | | | | Allow forwarding paste events to embedded applications. When a bracketed paste is in progress, do not process any command bindings. Signed-off-by: Robin Jarry <robin@jarry.cc> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
* term: replace go-libvterm with tcell-termTim Culverhouse2022-09-142-371/+77
| | | | | | | | | | | | | | | | Replace go-libvterm package with tcell-term. go-libvterm provides the embedded terminal for aerc. It uses a statically linked C library, requiring CGO. tcell-term is written in pure go and is written to be portable with tcell applications by implementing the tcell Widget interface. This allows the terminal to take a view (which aerc already supplies) and draw directly to it, as well as issue tcell Events to a Watcher. Enable setting cursor shapes in embedded terminals. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
* ui: cleanup internals and apiRobin Jarry2022-09-141-10/+5
| | | | | | | | | | | | | | | | Now that tcell events are handled in a goroutine, no need for a channel to buffer them. Rename ui.Tick() to ui.Render() and ui.Run() to ui.ProcessEvents() to better reflect what these functions do. Move screen.PollEvent() into ui.ProcessEvents(). Register the panic handler in ui.ProcessEvents(). Remove aerc.ui.Tick() from DecryptKeys(). What the hell was that? Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* config: add option to hide timezone in sent emailsMoritz Poldrack2022-09-141-1/+5
| | | | | | | | | | | | Some people are worried that they might leak their timezone and wish to send their mails with the Date header in UTC. For this a new key is added to the account sections to enforce sending in UTC instead of the system's timezone. Suggested-by: "Ricardo Correia" <aerc-lists.sr.ht@wizy.org> Thanks: to Ricardo for checking and correcting my incorrect assertions Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* move: enable MoveMessages from msgstoreTim Culverhouse2022-08-221-42/+48
| | | | | | | | | Enable the use of MoveMessages worker messages from the UI to the backend. Completes implemention of MoveMessages for all supported backends. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: improve cursor positionKoni Marti2022-08-221-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve cursor re-positioning while filtering with and without threads. Reposition cursor in client-side threading mode with a callback that is set during store.NextPrev(). Run callback when the threads are constructed in order to reposition the cursor correctly. The callback is deactivated when store.Select() is called. Steps to reproduce two issues: * Reproduce issue 1: 1. Activate client-side threading 2. Apply a filter, e.g. :filter -f Koni 3. Move cursor around so that a message is highlighted 4. clear filter with :clear 5. The cursor is expected to remain on the selected message but is actually not * Reproduce issue 2: 1. Activate client-side threading 2. Go the end of the message list 2. Apply a filter, e.g. :filter -f Koni 5. The cursor is now at the end of the filtered results instead of at the beginning This patch fixes both of those issues. Tested in regular and threaded view according to the following check list (expected behavior in parenthesis): 1. Apply filter from a message that remains in the filter (cursor on message, message selected) 2. Apply filter from a message that will not remain (cursor at the top, no message selected) 3. Clear filter (cursor remains on message, message selected) 4. Scroll line-by-line (threads: cursor remains on line, does not "jump" with message) 5. Search (cursor on first result) Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* dirtree: fix build errorsRobin Jarry2022-08-221-2/+3
| | | | | | | | | | | | | | | | | | | | Fix the following errors: widgets/dirtree.go:401:18: not enough arguments in call to dt.UiConfig have () want (string) (typecheck) if dt.UiConfig().DirListCollapse != 0 { ^ widgets/dirtree.go:402:38: not enough arguments in call to dt.UiConfig have () want (string) (typecheck) node.Hidden = depth > dt.UiConfig().DirListCollapse ^ Since commit e0b62db583c3 ("fix: Set proper UIConfig for msgstores"), DirectoryTree.UiConfig() takes a path parameter. Fixes: db39ca181adf ("dirtree: add dirtree-collapse config setting") Signed-off-by: Robin Jarry <robin@jarry.cc>
* dirtree: add dirtree-collapse config settingSijmen2022-08-221-3/+6
| | | | | | | | | | | | | Adds a setting to the configuration to choose at which level the folders in the dirtree are collapsed by default. In my case, this is useful because my organisation has some rather deep nesting in the folder structure, and a _lot_ of folders, and this way I can keep my dirtree uncluttered while still having all folders there if I need them. Signed-off-by: Sijmen <me@sijman.nl> Acked-by: Koni Marti <koni.marti@gmail.com>
* fix: Set proper UIConfig for msgstoresTim Culverhouse2022-08-224-24/+28
| | | | | | | | | | | | | | | | | | | The merged UIConfig used to create new message stores is based on the selected directory. If the message store is created by other means than selecting (ListDirectories for maildir/notmuch/mbox, or check-mail) it may have an incorrect configuration if the user has folder-specific values for: - Threaded view - Client built threads - Client threads delay - Sort criteria - NewMessage bell Use the correct merged UIConfig when creating a new message store. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: extract marking behavior and add testsKoni Marti2022-08-223-7/+10
| | | | | | | | Separate the marking functions from the message store and extract the marking behavior into its own class with tests. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* wizard: add plaintext password warningKoni Marti2022-08-221-0/+18
| | | | | | | | | Warn users that the passwords are stored as plaintext. Add recommmendation to use personal password store. Implements: https://todo.sr.ht/~rjarry/aerc/39 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* binds: display active keybinds in a dialog boxKoni Marti2022-08-222-0/+57
| | | | | | | | | Show contextual keybinds in a textbox when using the ':help keys' command. This command is bound to '?' by default. Fixes: https://todo.sr.ht/~rjarry/aerc/42 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* widgets: add list box with filter/scrollbarKoni Marti2022-08-221-0/+239
| | | | | | | | | | Implement a scrollable text box that displays a list of strings which can be filtered. The widget is closed by pressing ESC or ENTER. If ENTER is pressed and an entry has been selected, this text will be passed to the closing callback. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* widgets: add dialog interfaceKoni Marti2022-08-222-1/+32
| | | | | | | | Implement an interface for aerc's dialog implementation. Provide dialogs the ability to set their own height and width of their drawing context. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* go: removed io/ioutilMoritz Poldrack2022-08-221-3/+2
| | | | | | | | | | Since the minimum required version of Go has been bumped to 1.16, the deprecation of io/ioutil can now be acted upon. This Commit removes the remaining dependencies on ioutil and replaces them with their io or os counterparts. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: work nicely with wrapped errors (errorlint)Moritz Poldrack2022-08-043-6/+6
| | | | | | | | Error wrapping as introduced in Go 1.13 adds some additional logic to use for comparing errors and adding information to it. Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-0412-69/+54
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: removed unused code (deadcode, structcheck, unused)Moritz Poldrack2022-08-043-22/+0
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>