Commit Graph

81 Commits

Author SHA1 Message Date
Reto Brunner ea0df7bee4 dirlist: adapt to dynamic UIconfig 2020-01-28 10:36:01 -05:00
Reto Brunner 2a3d120d6f dirlist: remove not needed sort function
The docs of strings.Compare state:

> Compare is included only for symmetry with package bytes. It is usually
> clearer and always faster to use the built-in string comparison operators
> ==, <, >, and so on.

So let's do that.
2020-01-28 10:36:00 -05:00
Michele Finotto dfe58842b9 Add custom sorting for folders
A new config options for accounts.conf (folders-sort) was added to
allow a user to choose which folders should be shown on top.
My use case was to avoid stepping into heavy, but rarely viewed folders
when cycling through other often accessed ones.

To test add this to your account.conf:

folders-sort  = INBOX,Sent,Archive

INBOX, Sent and Archive should then show at the top of your dirlist,
and all other folders should come next in alphabetical order.
2019-12-09 12:42:40 -05:00
Jeffas 618a500341 Add display of unread messages in dirlist
Add an onUpdateDirs handler. This is used to invalidate the dirlist and
redraw with the correct number of recent/unread/total messages is shown.

A config option and formatting options are provided.
2019-09-11 12:37:43 -04:00
Jeffas f6216bb621 Add Mouseable
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.
2019-09-11 11:41:34 -04:00
Paul Spooren e4104a8674 Allow custom spinner via config file
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>
2019-08-30 10:32:28 +09:00
Daniel Xu 6fcc047c31 Only compile regex portion of folder filter
The code was trying to compile the `~` as well. In this case, it was
trying to match a literal `~` to the front of the supplied regex.

Fixes: 334ca89bea ("folder filter: only assume regex if filter is
~fmt")

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
2019-08-20 16:03:37 +09:00
Drew DeVault 334ca89bea folder filter: only assume regex if filter is ~fmt 2019-08-20 13:04:58 +09:00
Daniel Xu 9fd6054ca1 Support regex filters for folders
It's nice to be able to filter the folders displayed in the side
bar. Basic string matching can get verbose with enough folders
whitelisted.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
2019-08-19 15:22:59 +09:00
Jelle Besseling 3650b72ca6 Implement next-folder using NextPrev with amount
This fixes ~sircmpwn/aerc2#182

https://todo.sr.ht/~sircmpwn/aerc2/182
2019-08-07 15:02:11 +09:00
Jeffas 1b673b5ea7 Move msgstore map to dirstore
This map represents a mapping from directory names to their associated
messagestores anyway so they should be under dirstore. This simply moves
them there and adds some methods required to interact with them.
2019-07-26 14:15:27 -04:00
Jeffas 0950e39f53 Show the directory being selected in gray 2019-07-25 18:15:49 -04:00
Ben Burwell cce7cb4808 Factor UI models out of the worker message package
Before, the information needed to display different parts of the UI was
tightly coupled to the specific messages being sent back and forth to
the backend worker. Separating out a models package allows us to be more
specific about exactly what a backend is able to and required to
provide for the UI.
2019-07-08 16:06:23 -04:00
Drew DeVault f7387f8c60 Sort out dirstore once and for all 2019-07-04 12:31:27 -04:00
Reto Brunner b12eba55c3 dirlist: simplify nextPrev() considerably
Assuming we always have a sorted dirlist
(other code depends on that already), we don't need to loop over the
dirStore.
Any filtering done should be performed elsewhere
2019-07-04 12:24:16 -04:00
Reto Brunner 0abca31c15 dirlist: remove the additional filtering in Draw() 2019-07-04 12:24:16 -04:00
Reto Brunner d7fecf7740 dirlist: sync dirstore in filterDirsByFoldersConfig
Also sets the public List() method to return the unfiltered
list of directories directly from the store.
2019-07-04 12:24:16 -04:00
Gregory Mullen f9d26eef58 Add IMAP folder tab completion
Credit for this fix goes to Reto; I guess if we're not gonna be mutt
we should probabaly do things correctly.
2019-07-04 11:28:04 -04:00
Drew DeVault 491e360178 Revert "Remove dirs field and references to it"
This reverts commit 0e55637aac.
2019-07-02 19:43:41 -04:00
Robert Günzler 0e55637aac Remove dirs field and references to it
This fixes prev/next-folder that broke after
546dfcd76d
2019-06-30 10:33:50 -04:00
Gregory Mullen 546dfcd76d Add new lib/dirstore to source completions from 2019-06-29 14:24:19 -04:00
Gregory Mullen 2a0961701c Implement basic tab completion support
Tab completion currently only works on commands. Contextual completion
will be added in the future.
2019-06-29 14:24:19 -04:00
Reto Brunner 99c363b724 Set empty message in dirlist if no folder exist. 2019-06-14 10:42:26 -04:00
Reto Brunner 626f91c483 imap: respect the folder config option 2019-06-14 10:42:24 -04:00
Drew DeVault 98da4c9509 s/aerc2/aerc/g 2019-05-17 20:57:10 -04:00
Drew DeVault 07138146a0 Force INBOX to be included in dirlist 2019-05-14 16:53:47 -04:00
Drew DeVault 8fa4583230 Split ex line text handling into dedicated widget 2019-05-11 13:12:44 -04:00
Simon Ser 5685a17674 lib/ui: introduce Invalidatable
Many Drawable implementations have their own Invalidate and OnInvalidate
functions, with an unexported onInvalidate field. However OnInvalidate and
Invalidate are usually not called in the same goroutine. This results in a race
on this field, e.g.:

    Read at 0x00c000094748 by goroutine 7:
      git.sr.ht/~sircmpwn/aerc2/widgets.NewDirectoryList.func1()
          /home/simon/src/aerc2/widgets/dirlist.go:85 +0x56
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Spinner).Start.func1()
          /home/simon/src/aerc2/widgets/spinner.go:93 +0x1bb

    Previous write at 0x00c000094748 by main goroutine:
      [failed to restore the stack]

    Goroutine 7 (running) created at:
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Spinner).Start()
          /home/simon/src/aerc2/widgets/spinner.go:46 +0x8f
      git.sr.ht/~sircmpwn/aerc2/widgets.NewDirectoryList()
          /home/simon/src/aerc2/widgets/dirlist.go:37 +0x286
      git.sr.ht/~sircmpwn/aerc2/widgets.NewAccountView()
          /home/simon/src/aerc2/widgets/account.go:50 +0x5ca
      git.sr.ht/~sircmpwn/aerc2/widgets.NewAerc()
          /home/simon/src/aerc2/widgets/aerc.go:60 +0x800
      main.main()
          /home/simon/src/aerc2/aerc.go:65 +0x33e

To fix this, introduce a new type, Invalidatable, which protects the field.
Unfortunately the Drawable must be passed to the callback function in
Invalidate, so we still need to re-implement this in each Invalidatable user.
2019-04-27 14:30:28 -04:00
Drew DeVault 84965d680c Use tcell.Style.Reverse instead of black on white 2019-03-30 12:59:18 -04:00
Drew DeVault 9e3b602ce7 Fix nil dereference on rapidly cycling folders 2019-03-15 01:48:36 -04:00
Drew DeVault d274bf926c widgets/directories.go -> widgets/dirlist.go 2019-03-14 23:45:06 -04:00
Renamed from widgets/directories.go (Browse further)