Commit Graph

16 Commits

Author SHA1 Message Date
Koni Marti ae99f4c5bb msglist: display reversed thread ordering
Reverse the ordering of the message threads.

Implements: https://todo.sr.ht/~rjarry/aerc/54
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-27 22:47:30 +02:00
Koni Marti 6eed15c579 dirtree: fix folder scrolling
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>
2022-10-19 20:27:24 +02:00
Robin Jarry d138da0c9f dirtree: fix build errors
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: db39ca181a ("dirtree: add dirtree-collapse config setting")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-08-22 09:57:23 +02:00
Sijmen db39ca181a dirtree: add dirtree-collapse config setting
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>
2022-08-22 09:45:02 +02:00
Tim Culverhouse e1b62db583 fix: Set proper UIConfig for msgstores
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>
2022-08-22 09:30:37 +02:00
Moritz Poldrack 978d35d356 lint: homogenize operations and minor fixes (gocritic)
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>
2022-08-04 21:58:01 +02:00
Moritz Poldrack 5ca6022d00 lint: ensure errors are at least logged (errcheck)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:57 +02:00
Moritz Poldrack a8d631177f lint: merge declaration and assignment (S1021)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:55 +02:00
Moritz Poldrack ef599aa8fc lint: simplify code (gosimple)
Replaces infinite for loops containing a select on a channel with a
single case with a range over the channel.

Removes redundant assignments to blank identifiers.

Remove unnecessary guard clause around delete().

Remove `if condition { return true } return false` with return condition

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:52 +02:00
Moritz Poldrack 03f9f4c3ab lint: remove ineffectual assignments (ineffassign)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:50 +02:00
Moritz Poldrack 91981574cc lint: remove conditions that are always true (SA4003)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:38 +02:00
Moritz Poldrack aaf0a0c656 lint: apply new formatting rules
Run `make fmt`.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-01 10:44:52 +02:00
Tim Culverhouse 115447e57f dirlist: fix panic when disconnecting with dirlist-tree=false
Commit 2027223a created a panic when attempting to clear the dirlist
when the config option dirlist-tree is set to false.

This patch fixes that panic by creating a dirlist.ClearList() function
to prevent needing to check a callback.

Tested with both dirlist-tree=false and true

Fixes: 2027223ab3 ("fix: clear dirlist on disconnect")
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-07 18:01:25 +02:00
Tim Culverhouse afe35839ed style: add style config options for dirlist_unread and dirlist_recent
Adds two style options: dirlist_unread and dirlist_recent. These options
apply in layers, in the same way as msglist_* styles do.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-27 09:46:06 +02:00
Koni Marti 515a8b56f6 scrollable: extract scrolling behavior for reuse
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>
2022-03-03 21:11:05 +01:00
Koni Marti 454606a9cd dirtree: implement foldable tree for directory list
implement a foldable tree for the directory list. Expand all parent
directories when a hidden directory is selected with the change-folder
command.

folders-sort considers the top-level directories only. The folders and
foldersexclude filters work with the full directory path.

Enable tree view by adding 'dirlist-tree=true' to the config file.

Implements: https://todo.sr.ht/~sircmpwn/aerc2/228
Signed-off-by: Koni Marti <koni.marti@gmail.com>
2022-02-23 21:09:01 +01:00