aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msglist.go
Commit message (Collapse)AuthorAgeFilesLines
* threads: debounce client-side thread buildingKoni Marti2022-07-261-0/+1
| | | | | | | | | | | | | | | | Debounce client-side thread building in the message store. Debouncing is useful when multiple messages are loaded, i.e. when scrolling with PgUp/PgDown. Without the debouncing, all client-side threads will be built everytime the message store is updated which creates a noticable lag in the message list ui when client-side threading is activated. The default debouncing delay can be changed by changing 'client-threads-delay' in the UI config section. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: implement a uid-based architectureKoni Marti2022-07-261-5/+20
| | | | | | | | | | | Change the message store architecture from an index-based to a uid-based one. Key advantage of this design approach is that no reselect mechanism is required anymore since it comes with the design for free. Fixes: https://todo.sr.ht/~rjarry/aerc/43 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-231-4/+1
| | | | | | | | | | | | Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* threading: refactor reselect logicTim Culverhouse2022-07-101-21/+1
| | | | | | | | | | This patch refactors reselection of a message during certain operations (searching, filtering, clearing, deleting, moving, new message arrival). The addition of server-side filtering for threaded views broke the existing reselection logic. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: enable toggle-threads for server-side threadsTim Culverhouse2022-07-101-1/+1
| | | | | | | | | | Enable the :toggle-threads command to work for workers which have Thread capability. The implementation of that feature has the side effect that the threading-enabled config option now sets the default view (threaded or not threaded) for any worker, not just IMAP or notmuch. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: fix panic for index-out-of-rangeTim Culverhouse2022-07-101-3/+1
| | | | | | | | | | I didn't save the stack trace, but msglist.Selected() can create a panic for index out of range due to the math operations in the map. My stack trace resulted in a [-9]. This patch reuses the msgstore.Selected() method, which already has bounds checking. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* perf: reduce calls to GetUiConfigTim Culverhouse2022-07-031-7/+16
| | | | | | | | | | | | | | | | | | GetUiConfig was being called many times, and came up as a high CPU user in a cpuprofile. Every call would merge a UIConfig, which is a costly operation. Ideally, we would only need to have a config for every account X every directory. We also have a context for subjects. This patch stores all FOLDER and ACCOUNT level configs and reuses those merged objects. The SUBJECT contexts are not stored in favor of merging on-the-go, with a TODO comment to deprecate that feature and implement a better per-message styling option. I suspect this feature is not used very much. Before applying this patch with my setup, GetUiConfig is called 1159 times just to open aerc. After applying, this is reduced to 37. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* refactor: refactor pgp implementationTim Culverhouse2022-04-271-1/+2
| | | | | | | | | This commit refactors the internal PGP implementation to make way for GPG integration. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: update message counter upon filter changeKoni Marti2022-03-201-0/+6
| | | | | | | | | | | | | | | | Update message counter in msglist when the filter is changed (either set or cleared in the msgstore). When we apply a filter, we change the number of uids in the message store. This can unintentionally trigger the storeUpdate() function of the msglist which checks the number of uids for new messages and advances the pointer by the difference in the number of messages. This can be avoided when we update the message counter upon changing the filter. Fixes: https://todo.sr.ht/~rjarry/aerc/23 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* scrollable: extract scrolling behavior for reuseKoni Marti2022-03-031-52/+15
| | | | | | | | | Extract the vertical scrolling ability into its own Scrollable struct that can be embedded and reused across any ui element that relies on scrolling. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: always check SelectedAccount return valueRobin Jarry2022-02-251-12/+15
| | | | | | | | | | | | | | | | aerc.SelectedAccount() is used in lots of places. Most of them without checking the return value. In some cases, the currently selected tab is not related to any account (widget.Terminal for example). This can lead to unexpected crashes when accessing account specific configuration. When possible, return an error when no account is currently selected. If no error can be returned, fallback to non-account specific configuration. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com>
* threading: implement on-the-fly message threadingKoni Marti2022-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | implement message threading on the message store level using the jwz algorithm. Build threads on-the-fly when new message headers arrive. Use the references header to create the threads and the in-reply-to header as a fall-back option in case no references header is present. Does not run when the worker provides its own threading (e.g. imap server threads). Include only those message headers that have been fetched and are stored in the message store. References: https://www.jwz.org/doc/threading.html Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Tested-by: akspecs <akspecs@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* messages: allow displaying email threadsy0ast2021-11-131-81/+174
| | | | | | | | | | | | | Display threads in the message list. For now, only supported by the notmuch backend and on IMAP when the server supports the THREAD extension. Setting threading-enable=true is global and will cause the message list to be empty with maildir:// accounts. Co-authored-by: Kevin Kuehler <keur@xcf.berkeley.edu> Co-authored-by: Reto Brunner <reto@labrat.space> Signed-off-by: Robin Jarry <robin@jarry.cc>
* index: add this-week-time-formatRobin Jarry2021-11-061-1/+3
| | | | | | | Also allow specific time format for messages received within the last 7 days. Signed-off-by: Robin Jarry <robin@jarry.cc>
* go.mod: change base git urlRobin Jarry2021-11-051-5/+5
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* index: allow dynamic formatting of message datesRobin Jarry2021-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | When a message has been sent today (or this year) allow formatting the date differently. For example, with: [ui] index-format=%-25.25n %-25.25D %s timestamp-format=2006 Jan 02, 15:04 GMT-0700 this-day-time-format=Today at 15:04 this-year-time-format=Jan 02 The message list would look like this (spaces collapsed): Robin Jarry Today at 16:30 [PATCH 1/2] bindings: prepare for more modifers bugzilla@dpdk.org Oct 26 [dpdk-dev] [Bug 839] pdump: any subsequent runs of pdump_autotest fail Holger Levsen 2020 Mar 15, 13:44 GMT+01 +1 (Re: FTP Team -- call for volunteers) Signed-off-by: Robin Jarry <robin@jarry.cc>
* Reapply 'Fix nil pointer deref on Envelope'Shaw Vrana2021-01-031-3/+6
| | | | | | The commit bf16ccde484ce3b6d2a4b843e7ebc04a9b2a957d appears to have been unintentionally dropped by commit 905cb9dfd3ef197bb4b59039a1be76ce2c8e3099 (Implement style configuration).
* update tcell to v2 and enable TrueColor supporty0ast2020-12-181-1/+1
| | | | | | | | | Also update to the tcell v2 PaletteColor api, which should keep the chosen theme of the user intact. Note, that if $TRUECOLOR is defined and a truecolor given, aerc will now stop clipping the value to one of the theme colors. Generally this is desired behaviour though.
* Apply relevant msglist styles in orderChris Vittal2020-11-011-13/+14
| | | | | | | | | | | | | | | | | | Allow styles to be layered over a base style. The list of styles to apply is layered over the base style in order, such that if the layer does not differ from the base it is not used. The order that these styles are applied in is, from first to last: msglist_default msglist_unread msglist_read (exclusive with unread, so technically the same level) msglist_flagged msglist_deleted msglist_marked So, msglist_marked style dominates. This fixes an issue where the msglist_deleted style was not being applied.
* refactor ParseMessageFormat to use a ctx objectReto Brunner2020-10-141-3/+8
|
* correctly apply msglist_read colory0ast2020-09-011-1/+4
|
* Implement style configuration.Kalyan Sriram2020-08-061-18/+32
| | | | | | Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
* Revert "Implement style configuration."Reto Brunner2020-07-301-32/+18
| | | | This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
* Implement style configuration.Kalyan Sriram2020-07-301-18/+32
| | | | | | Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
* Fix nil pointer deref on EnvelopeAndrew Jeffery2020-07-021-3/+7
| | | | | The Envelope was nil but being deref'ed for the Subject. This was experienced when switching tabs on IMAP.
* Add scrollbarJeffas2020-06-091-3/+37
| | | | | This transplants the logic for drawing the scrollbar from dirlist and the completion popover and adds it to the msglist.
* Rework msglist scrollingJeffas2020-06-091-14/+30
| | | | | | | | | | | | This changes the scrolling to be done on the draw, when the height is updated, ensuring that the selected item is kept on screen during resizing. Also, this ensures that messages will fill the screen when resizing the window, for instance, shrinking and then growing drags down more messages if possible. This is a transplant of the dirlist scrolling logic.
* Revert "Add Style configuration"Drew DeVault2020-05-281-37/+18
| | | | This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
* Revert "Remove duration from the status methods"Drew DeVault2020-05-281-1/+2
| | | | This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
* Remove duration from the status methodsReto Brunner2020-05-271-2/+1
| | | | We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
* Add Style configurationReto Brunner2020-05-271-18/+37
| | | | | | | | | | The following functionalities are added to configure aerc ui styles. - Read stylesets from file with very basic fnmatch wildcard matching - Add default styleset - Support different stylesets as part of UiConfig allowing contextual styles. - Move widgets/ui elements to use the stylesets. - Add configuration manual for the styleset
* pgp: fail gracefully from email decryptionRay Ganardi2020-05-251-1/+5
| | | | | Aerc panics when there's an error on email decryption. Instead, an error message should be shown.
* Initial support for PGP decryption & signaturesDrew DeVault2020-03-031-2/+5
|
* Only show spinner while sorting if no uidsJeffas2020-02-281-7/+7
| | | | | This fixes the problem where we already have messages and then have to sort again.
* Don't show empty message while sortingJeffas2020-02-281-0/+6
| | | | | | This changes the ui to show the spinner while we are sorting. It only shows one line of the spinner since there are an unknown number of messages at this time.
* Fix crash on mouse scrolling before messages loadWiktor Kwapisiewicz2020-02-221-2/+6
| | | | | Using mouse scroll before messages load will trigger a panic as `ml.store` has not been assigned yet and is `nil`.
* config: Strongly type context typeReto Brunner2020-01-241-1/+1
| | | | | | | | The go compiler can't help much with untyped int constants. Even though the only valid constants are 0-3 it will happily accept 4 as input. Let's let the go compiler worry about correctness here. This also allows people not very familiar with the code to use it properly via auto completion.
* Contextual UI ConfigurationSrivathsan Murali2020-01-241-3/+9
| | | | | | | | | + Adds parsing of contextual ui sections to aerc config. + Add GetUiConfig method for AercConfig that is used to get the specialized UI config. + Add UiConfig method to AccountView to get specialized UI Config. + Modifies Aerc codebase to use specialized UIConfig instead. + Adds documentation for Contextual UI Configuration
* msglist: highlight marked messagesReto Brunner2019-12-211-1/+1
| | | | | | Note that, until we get color configuration, this means that the user *must* have the %Z verb in the index format else it'll be horribly confusing as no visual indication is provided
* Complete the F rune.Srivathsan Murali2019-11-171-0/+1
| | | | | %F now shows the auth name or recepient name/address if the message is from you.
* Revert "Show spinner when fetching contents"Drew DeVault2019-10-091-3/+0
| | | | This reverts commit 1339faf7881f33762c6e0a4915404e362fc51de1.
* Show spinner when fetching contentsJeffas2019-10-091-0/+3
| | | | | The spinner should be shown when fetching the contents as we don't know at that point whether there are some messages or not.
* Revert "Fix out-of-order messages by sorting as we display"Drew DeVault2019-09-181-31/+0
| | | | This reverts commit ac99d9ed62644cf0259bdd79481b28c3fbcef650.
* Add MouseableJeffas2019-09-111-1/+44
| | | | | | | | | | | | | | | | | | | | | | This adds the Mouseable interface. When this is implemented for a component that item can accept and process mouseevents. At the top level when a mouse event is received it is passed to the grid's handler and then it trickles down until it reaches a component that can actually handle it, such as the tablist, dirlist or msglist. A mouse event is passed so that components can handle other things such as scrolling with the mousewheel. The components themselves then perform the necessary actions. Clicking emails in the messagelist opens them in a new tab. Textinputs can be clicked to position the cursor inside them. Mouseevents are not forwarded to the terminal at the moment. Elements which do not handle mouse events are not required to implement the Mouseable interface.
* widgets: gofmtWagner Riffel2019-09-041-2/+2
| | | | Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
* Use sort.Stable for sorting displayed messagesa3v2019-09-021-1/+1
| | | | | With sort.Sort, sometimes two messages with the same timestamp will switch places every time the message list is redrawn
* Allow custom spinner via config filePaul Spooren2019-08-301-1/+1
| | | | | | | | | | | Allows to set `ui.spinner=` to a string which is then split by `ui.spinner-delimiter=` (Default: comma) instead of having a hard coded animation. This implementation doesn't use INIs capabilities to split strings as it trims whitespaces breaking the default animation. Signed-off-by: Paul Spooren <mail@aparcar.org>
* Fix out-of-order messages by sorting as we displayStephen Brennan2019-08-291-0/+31
| | | | | | | | | | Sometimes I observe out-of-order messages when using a maildir inbox. It appears that the UIDs for these messages are returned out of order by the MessageStore. In order for a maildir MessageStore to return messages in most recently received order, it must have already opened all messages and parsed the date to use as a sort key. Rather than implement that, simply sort messages by time as we display. This fix shows my emails in order.
* msglist: add initialization stateReto Brunner2019-08-021-15/+31
| | | | | | | | | Make the msglist aware of whether we are still initializing or not. We never stopped spinning the msglist if we didn't get any Directories back from types.ListDirectories. With this change, we can set the init state from the account and display the spinner only if we don't know whether we have directories or not and else the "no messages" string from the config.
* Add new-email triggerJeffas2019-07-261-1/+4
| | | | | | | | | | | | | | | | | This patch sets up the trigger config section of aerc.conf. Each trigger has its own function which is called from the place where it is triggered. Currently only the new-email trigger is implemented. The triggers make use of format strings. For instance, in the new-email trigger this allows the user to select the trigger command and also the information extracted from the command and placed into their command. To actually execute the trigger commands the keypresses are simulated. Further triggers can be implemented in the future. Formatting of the command is moved to a new package.