aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/dirtree.go
Commit message (Collapse)AuthorAgeFilesLines
* logging: rename package to logRobin Jarry2022-12-021-3/+3
| | | | | | | | | | Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* dirtree: fix mouse support for selecting foldersKoni Marti2022-11-131-5/+12
| | | | | | | | | Fix mouse support for selecting folders. Toggle foldable directories to expand or collapse when clicked on. Fixes: https://todo.sr.ht/~rjarry/aerc/99 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* dirtree: show dynamic folders properlyKoni Marti2022-11-091-0/+15
| | | | | | | | | | Show dynamic folders from notmuch queries using :cf when using the directory tree view. The current dirtree implementation would swallow the query list entry but show the folder contents correctly in the message list. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
* dirtree: prevent panic when no folder is foundKoni Marti2022-11-091-1/+1
| | | | | | | | | Prevent crash when no folder is found. Fixes: https://todo.sr.ht/~rjarry/aerc/100 Fixes: https://todo.sr.ht/~rjarry/aerc/101 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
* msglist: display reversed thread orderingKoni Marti2022-10-271-1/+1
| | | | | | | | 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>
* 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>
* 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-221-5/+5
| | | | | | | | | | | | | | | | | | | 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>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-041-4/+3
| | | | | | | | | | | | | | | | | | 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: ensure errors are at least logged (errcheck)Moritz Poldrack2022-08-041-2/+9
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: merge declaration and assignment (S1021)Moritz Poldrack2022-08-041-2/+1
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: simplify code (gosimple)Moritz Poldrack2022-08-041-1/+1
| | | | | | | | | | | | | | 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>
* lint: remove ineffectual assignments (ineffassign)Moritz Poldrack2022-08-041-3/+0
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: remove conditions that are always true (SA4003)Moritz Poldrack2022-08-041-1/+1
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-011-1/+1
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* dirlist: fix panic when disconnecting with dirlist-tree=falseTim Culverhouse2022-06-071-0/+4
| | | | | | | | | | | | | | 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: 2027223ab302 ("fix: clear dirlist on disconnect") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: add style config options for dirlist_unread and dirlist_recentTim Culverhouse2022-04-271-4/+15
| | | | | | | | 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>
* scrollable: extract scrolling behavior for reuseKoni Marti2022-03-031-38/+7
| | | | | | | | | 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>
* dirtree: implement foldable tree for directory listKoni Marti2022-02-231-0/+468
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>