aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* maildir: replace ListFolder method with FolderMapJulian Pidancet2022-10-272-11/+10
| | | | | | | | | | | Replace ListFolder with a new method that returns a map indexed by folder names instead of a list of folder names. A map is simpler to use and more efficient in case we only want to check the presence of a specific folder in the Maildir store. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* maildir: move common maildir code out of workerJulian Pidancet2022-10-274-143/+172
| | | | | | | | | This change moves code that could be common to both notmuch and maildir workers in worker/lib. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: add IndexFile and DeleteMessage methods to notmuch.DBJulian Pidancet2022-10-271-0/+29
| | | | | | | | | The new IndexFile and DeleteMessage allow dynamically inserting and removing files to/from a notmuch database. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: add MsgFilenames method to notmuch.DBJulian Pidancet2022-10-271-0/+25
| | | | | | | | | | Multiple files on the filesystem can be referenced under a single key in the notmuch database. MsgFilenames() returns a list of filenames associated with an index key. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* envelope: display message envelope infoKoni Marti2022-10-263-0/+165
| | | | | | | | | Display entire message envelope in a user-friendly dialog popup with the :envelope command. All header fields can be displayed with the -h flag. Fixes: https://todo.sr.ht/~rjarry/aerc/85 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* listbox: implement horizontal scrollingKoni Marti2022-10-262-1/+64
| | | | | | | | | | | | | | | Implement horizontal scrolling for selected lines that are longer than dialog width. The following keys can be used: Ctrl-a, Home jump to beginning of line Ctrl-e, End jump to end of line Left move one character back Right move one character forward Ctrl+b move one word back Ctrl+w move one word forward Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: fix maildir folder listingJulian Pidancet2022-10-251-1/+1
| | | | | | | | | | | | | | | Previous change "maildir: hide invalid folders" prevents filepath.Walk from descending into directories that don't contain new/, tmp/ or cur/ because the WalkDirFunc returns filepath.SkipDir. We have to assume that these directories can be the parent of valid maildir folders even if they're not themselves valid maildir folders, so it is a mistake not to recurse into these subfolders. Fix it by returning nil instead of filepath.SkipDir in the WalkDirFunc. Fixes: 150aa0f498b9 ("maildir: hide invalid folders") Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pipe: reorder patches based on email subjectsRobin Jarry2022-10-252-25/+12
| | | | | | | | | | | | | | | | | | | | | The Message-Id header cannot be relied upon as users can tweak it before sending. The subject seems a more reliable basis to reorder patches. Change the logic of sorting. Previously, all messages were required to look like patches to be sorted. Now if at least one message looks like a patch, all messages will be sorted by Subject before piping them. Since `git am` ignores non-patch messages, it should allow piping series of emails including reviews and comments without getting confusing errors. I have tested that this works on multiple series that appeared out of order in my INBOX with the following command (after marking the messages): :pipe -m sed -n 's/^Subject: //p' Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* types: remove unused FullMessage.Info fieldRobin Jarry2022-10-251-1/+0
| | | | | | | | This field is always nil. Either we should initialize it to a proper value or remove it. Since it is unused, remove it. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* colorize: make it compatible with BSD awkRobin Jarry2022-10-231-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following error seen on MacOS: /usr/bin/awk: syntax error at source line 22 source file header_pattern = >>> @ <<< /^[A-Z][[:alnum:]-]+:/ The @ character in front of regular expressions to pre-compile them seems not in the POSIX specification. Replace them with regular strings and call match() instead of the ~ operator. Also, adjust the url_pattern expression for BSD awk which explicitly states: The awk utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification, except awk does not support {n,m} pattern matching. Use [[:lower:]]+ instead of [a-z]{2,6}. Tested with: GNU Awk 5.1.1 awk version 20121220 (FreeBSD) Link: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html Fixes: https://todo.sr.ht/~rjarry/aerc/96 Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* Release version 0.13.00.13.0Robin Jarry2022-10-202-1/+3
| | | | Signed-off-by: Robin Jarry <robin@jarry.cc>
* git-stats.sh: strip trailing white spaceRobin Jarry2022-10-201-1/+2
| | | | Signed-off-by: Robin Jarry <robin@jarry.cc>
* split: clamp minimum split size to 1Tim Culverhouse2022-10-201-0/+4
| | | | | | | | | | | | The split command allows delta size changes, which triggers a condition where the split can overflow into the dirlist. Clamp the minimum size of a split or vsplit to "1" to prevent the view from overflowing, or completely covering the message list. A split of 0 will still clear the split. Reported-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* changelog: remove duplicate entryRobin Jarry2022-10-201-1/+0
| | | | | Fixes: 56b9528d3a4c ("changelog: refine before release") Signed-off-by: Robin Jarry <robin@jarry.cc>
* changelog: refine before releaseRobin Jarry2022-10-201-3/+5
| | | | | | Add missing entries. Remove implementation details. Signed-off-by: Robin Jarry <robin@jarry.cc>
* contrib: add git-stats.shRobin Jarry2022-10-202-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git shortlog -sn is nice but it does not display the number of changed files and the amount of changed lines. $ git shortlog -sn 0.12.0.. 46 Tim Culverhouse 28 Robin Jarry 14 Koni Marti 9 Moritz Poldrack 2 Ben Cohen 2 Bence Ferdinandy 2 Julian Pidancet 2 inwit 1 Jason Cox 1 Jason Stewart 1 John Gebbie 1 Tobias Wölfel 1 kt programs Add a simple bash script that adds extra information: $ ./contrib/git-stats.sh 0.12.0.. Author Commits Changed Files Insertions Deletions Tim Culverhouse 46 134 +973 -1090 Robin Jarry 28 70 +671 -358 Koni Marti 14 47 +437 -205 Moritz Poldrack 9 18 +178 -44 Ben Cohen 2 2 +16 -2 Bence Ferdinandy 2 6 +104 +0 Julian Pidancet 2 9 +149 -2 inwit 2 3 +11 -1 Jason Cox 1 7 +106 -6 Jason Stewart 1 1 +4 -2 John Gebbie 1 3 +118 -1 Tobias Wölfel 1 3 +3 -3 kt programs 1 3 +37 -6 Use the script to generate the release tag and email. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-on-irc-by: Tim Culverhouse <tim@timculverhouse.com>
* filters/colorize: various fixesRobin Jarry2022-10-201-27/+19
| | | | | | | | | | | | | | | | Diff chunks can occur in the middle of email conversations followed by regular and/or quoted text. Handle that properly. Change diff meta lines inside quotes to bold. Update the meta lines with more combination for renamed, copied and deleted files. Fix the diff_chunk invalid color code, only colorize the chunk characters, not the whole line. Remove redundant variable resets to 0. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-on-irc-by: Tim Culverhouse <tim@timculverhouse.com>
* lib: fallback on raw msg when decoding failsKoni Marti2022-10-191-1/+11
| | | | | | | | | | | | | | Avoid panic when part decoding fails: panic: quotedprintable: invalid unescaped byte 0x0c in body User-friendlier fallback when a (decoding) error occurs while reading a message part. Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CCNJRVKUG8T68.3TVA2T10DTTBA%40guix-framework%3E Reported-by: "(" <paren@disroot.org> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* split: prevent panic when store is not setTim Culverhouse2022-10-191-0/+3
| | | | | | | | | | | | Prevent panic when split is called but the msgstore is either not initialized or has no UIDs. This condition could be triggered by calling :split or :vsplit immediately at startup. Use the same logic as the :view command, which could operate in a similar manner. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgview: enable next/prev with unfetched headersKoni Marti2022-10-191-14/+26
| | | | | | | | | | | Fix message view behavior for unfetched headers. When scrolling "over" the message list boundary, current behavior is to close the message viewer tab. Now, the headers will be fetched so that we can scroll through the messages uninterrupted. Fixes: https://todo.sr.ht/~rjarry/aerc/90 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* split: prevent opening split when no messages are selectedTim Culverhouse2022-10-192-10/+18
| | | | | | | | | The [v]split command panics when it is run with no message selected, or when messages aren't loaded. Check for a valid selected message before creating a split, and report an error if one isn't selected. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* command/help: remove helpClose functionTim Culverhouse2022-10-192-27/+0
| | | | | | | | | | | | | The helpClose function is used to call UpdateScreen on MessageViewer, which has the effect of invalidating and redrawing the message view. This logic is redundant with the addition of tcell-term and the main event loop. Remove the helpClose calls. Remove the UpdateScreen methods from messageviewer: those functions are only used by the helpClose function. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
* terminal: bump tcell-term versionTim Culverhouse2022-10-192-3/+3
| | | | | | | | | | Upgrade tcell-term to v0.3.0. - Fixes erase line handling - Wide character support Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* terminal: properly handle cursor displayTim Culverhouse2022-10-191-15/+13
| | | | | | | | | The terminal widget reports if the cursor should be displayed. Properly handle this output to report cursor display back to aerc. Reported-by: staceee Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgview: add separate date formattingBence Ferdinandy2022-10-194-47/+101
| | | | | | | | | | The ThisDayTimeFormat and friends are missing from the message view which just uses the message list's default setting. This might not be desirable since the amount of space available is different. Introduce separate settings for formatting dates in the message view. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirtree: fix folder scrollingKoni Marti2022-10-191-3/+2
| | | | | | | | Fix scrolling by correcting the index calculation. Fixes: https://todo.sr.ht/~rjarry/aerc/93 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
* lint: check for bad white space habitsRobin Jarry2022-10-199-39/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A little coding hygiene cannot hurt. Add a simple awk script to check all source files for bad white space habits: - trailing white space - trailing new lines at the end of files - missing new line at the end of files - spaces followed by tabs The script outputs color when the terminal supports it. It exits with a non-zero code when there was at least one white space issue found. Call the script in the lint step. Example output of the awk script: config/default_styleset:1:# <-- trailing whitespace config/default_styleset:3:# <-- trailing whitespace doc/aerc.1.scd:78: Executes an arbitrary command in the background. Aerc will set the <-- trailing whitespace doc/aerc.1.scd:234: <-- trailing whitespace doc/aerc.1.scd:237: <-- trailing whitespace worker/types/thread_test.go:74: // return ErrSkipThread<-- space(s) followed by tab(s) worker/lib/testdata/message/invalid/hexa: trailing new line(s) Fix issues reported by the script. NB: The ENDFILE match is a GNU extension. It will be ignored on BSD-awk and trailing new lines will not be detected. The lint make target is only invoked on alpine linux which has GNU awk anyway. NB: Empty cells in scdoc tables require trailing white space... Avoid this by setting content in these cells. I don't really see a use for empty cells. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* check-mail: update man page to for check-mail(-cmd) clarityBen Cohen2022-10-181-2/+2
| | | | | | | | Update aerc(1) to state that check-mail-cmd is only required for using check-mail within aerc. Signed-off-by: Ben Cohen <ben@bencohen.net> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: make checkmail update directory countsBen Cohen2022-10-181-0/+14
| | | | | | | | Non-selected folders will now have their total/unread/new counts updated in the background when a check-mail happens. Signed-off-by: Ben Cohen <ben@bencohen.net> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: add :split and :vsplit view optionsTim Culverhouse2022-10-185-0/+252
| | | | | | | | | | | Add :split and :vsplit commands, which split the message list view to include a message viewer. Each command takes an int, or a delta value ("+1", "-1"). The int value is the resulting size of the message list, and a new message viewer will be displayed below / to the right of the message list. This viewer *does not* set seen flags. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aercmsg: add AercFuncMsg and QueueFuncTim Culverhouse2022-10-182-0/+12
| | | | | | | | | | Introduce AercFuncMsg and QueueFunc. These are used in combination to queue a function to be run in the main goroutine. This can be used to prevent data races in delayed function calls (ie from debounce functions). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: simplify filter and pager command handlingTim Culverhouse2022-10-182-92/+67
| | | | | | | | | | | | | | | | | | | Refactor the filtering and paging logic to use several fewer goroutines. Fixes data race condition with the timing of filter -> pager -> terminal, can be found when switching message views fast. Check if filter -> pager process is currently running before calling it to start again. Fixes data race between fetching message body and terminal starting. Both can initiate the copying process, and for long running filters and fast message fetching, it is possible to have fetched a message but still be running the filter when the terminal starts. Move StripAnsi to it's own file in lib/parse, similar to the hyperlinks parser. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: warn before sending without attachmentJason Cox2022-10-177-6/+106
| | | | | | | | | | Prevent the embarrassing forgotten attachment scenario by warning the user before sending a message that may need an attachment but does not have one. Whether a message needs an attachment is determined by testing a configurable regex against the message body. Signed-off-by: Jason Cox <dev@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* switch-account: fix out-of-bounds panicKoni Marti2022-10-171-0/+3
| | | | | | | | | | Fix out-of-bounds panic by updating the focused int variable when headers change in the switch-account commands. Fixes: d371c1ac8 ("commands: add switch-account command for composer") Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* docs: document existing command aliasesinwit2022-10-171-0/+9
| | | | | | | Almost no command aliases were documented. Fix that. Signed-off-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: add "tag" alias for modify-labels commandinwit2022-10-172-1/+2
| | | | | | | | In order to make things easier for newcomers from notmuch, add a tag command which is just an alias for modify-labels. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* commands: split open-link in separate fileRobin Jarry2022-10-162-19/+46
| | | | | | | | | These two commands have virtually zero in common. Move open-link in its own file. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* filters: export mime type and filename in envRobin Jarry2022-10-164-1/+21
| | | | | | | | | | | Export AERC_MIME_TYPE and AERC_FILENAME in the filters command environment. This allows dynamic coloring with tools that require a filename and/or a mime type to determine the syntax. Update docs and add example use in the default config file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* msgpart: factorize mime type and filename constructionRobin Jarry2022-10-168-28/+30
| | | | | | | Reduce code duplication. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* config: reference built-in filter scriptsRobin Jarry2022-10-161-4/+10
| | | | | | | | | | | | | Now that the share/filters folders are in $PATH when running the commands, let's reference the scripts by their name. Add more filter examples, some of them using the built-in filters, some of them not... Suggested-by: Teo Luppi <me@luppi.uk> Suggested-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* filters: append well known dirs to exec PATHRobin Jarry2022-10-165-3/+31
| | | | | | | | | | | | | | | | | | | 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-122-0/+11
| | | | | | | | | | | 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-1241-303/+76
| | | | | | | | 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>
* mk: exclude govulncheck from lintRobin Jarry2022-10-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vulnerability database is evolving with time. It can cause the lint step to fail suddenly without any source code changes on our side. Moreover, sometimes, there is nothing we can do to fix the issue nor to silence that specific error. Found 1 known vulnerability. Vulnerability #1: GO-2022-1039 Programs which compile regular expressions from untrusted sources may be vulnerable to memory exhaustion or denial of service. The parsed regexp representation is linear in the size of the input, but in some cases the constant factor can be as high as 40,000, making relatively small regexps consume much larger amounts of memory. After fix, each regexp being parsed is limited to a 256 MB memory footprint. Regular expressions whose representation would use more space than that are rejected. Normal use of regular expressions is unaffected. Call stacks in your code: config/config.go:1000:46: git.sr.ht/~rjarry/aerc/config.AercConfig.LoadBinds calls regexp.Compile, which eventually calls regexp/syntax.Parse Found in: regexp/syntax@go1.18.6 Fixed in: regexp/syntax@go1.19.2 More info: https://pkg.go.dev/vuln/GO-2022-1039 Move govulncheck into its own make target to be executed manually. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* invalidatable: always mark ui as dirty OnInvalidateTim Culverhouse2022-10-073-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Invalidatable struct is designed so that a widget can have a callback function ran when it is Invalidated. This is used to cascade up the widget tree, marking things as Invalid along the way so that only Invalid widgets are drawn. However, this is only implemented at the grid cell level for checks if the cell is invalidated -- and the grid cells are never set back to a "valid" state. The effect of this is that no matter what is invalidated, the entire UI gets drawn again. The calling through the Invalidate callbacks creates *several* race conditions, as Invalidate is called from several different goroutines, and many widgets call invalidate on their parent or children. Tcell has optimizations to only rerender screen cells that have changed their rune and style. The only performance penalty by redrawing the entire screen for aerc is the operations *within the aerc draw methods*. Most of these are not expensive and have relatively no impact on performance. Skip all of the OnInvalidates, and directly invalidate the UI when DoInvalidate is called by a widget. This reduces data races, and simplifies the widget redraw logic signficantly. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* 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>
* render: clean up render codeTim Culverhouse2022-10-071-11/+1
| | | | | | | | | | | | The render method sets everything as invalid if there was a popover. This is no longer necessary, as everything is redrawn anyways. Remove the check and extra atomic set of dirty and invalidate. Remove unused return value Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>