about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorKalyan Sriram <kalyan@coderkalyan.com>2021-11-13 08:10:09 +0000
committerRobin Jarry <robin@jarry.cc>2021-11-13 15:25:04 +0100
commit402612fd9788f071a5d7ae0045989977b98d896f (patch)
tree7d48f203a922cb6933146bda744f5dc3a9e90b07 /widgets
parent88d28908d2b2cd9d416bce76f384153ba1267cdb (diff)
downloadaerc-402612fd9788f071a5d7ae0045989977b98d896f.tar.gz
notmuch: allow sort by file order
When using the notmuch backend, it often makes more sense to sort
folders (actual virtual folders, or queries) by the order specified in
the query-map file, rather than alphabetically. This patch introduces a
configuration option (disabled by default) that allows this.

Additionally, due to the notmuch backend previously using maps (which
are order-undefined) to store the list of queries, default query
selection on aerc startup fluctuated. This patch fixes that by using
slices to store query order.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/dirlist.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 4db80a4..0345380 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -105,7 +105,9 @@ func (dirlist *DirectoryList) Select(name string) {
 				if !hasSelected && dirlist.selected != "" {
 					dirlist.dirs = append(dirlist.dirs, dirlist.selected)
 				}
-				sort.Strings(dirlist.dirs)
+				if dirlist.acctConf.EnableFoldersSort {
+					sort.Strings(dirlist.dirs)
+				}
 				dirlist.sortDirsByFoldersSortConfig()
 			}
 			dirlist.Invalidate()
@@ -376,6 +378,10 @@ func folderMatches(folder string, pattern string) bool {
 // AccountConfig.FoldersSort option. Folders not included in the option
 // will be appended at the end in alphabetical order
 func (dirlist *DirectoryList) sortDirsByFoldersSortConfig() {
+	if !dirlist.acctConf.EnableFoldersSort {
+		return
+	}
+
 	sort.Slice(dirlist.dirs, func(i, j int) bool {
 		foldersSort := dirlist.acctConf.FoldersSort
 		iInFoldersSort := findString(foldersSort, dirlist.dirs[i])
66ac6bbf13f2'>^
795f5244 ^
d855b0a0 ^
f2818edc ^
d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^



dc1323e9 ^
1066660e ^
cdd6fd09 ^
1066660e ^
f2818edc ^

6f8f9fb5 ^

795f5244 ^
f2818edc ^
88be3dbc ^
f2818edc ^
100157d1 ^
d7494165 ^
100157d1 ^


d7494165 ^


201b2e6c ^
1848b18f ^

201b2e6c ^
795f5244 ^
d855b0a0 ^
201b2e6c ^
d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^



dc1323e9 ^
0487a30e ^
cdd6fd09 ^
201b2e6c ^

1066660e ^
cdd6fd09 ^
1066660e ^
201b2e6c ^

88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
d7494165 ^
201b2e6c ^
88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
57699011 ^
201b2e6c ^
1848b18f ^

201b2e6c ^
795f5244 ^
d855b0a0 ^
201b2e6c ^
d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^
795f5244 ^
e4630643 ^

d855b0a0 ^



dc1323e9 ^
0487a30e ^
cdd6fd09 ^
201b2e6c ^

1066660e ^
cdd6fd09 ^
1066660e ^
201b2e6c ^

88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
d7494165 ^
201b2e6c ^
88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
57699011 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153