aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-07-30 17:36:56 +0200
committerRobin Jarry <robin@jarry.cc>2022-07-31 20:02:46 +0200
commit318f7d252c6daa9c44b8ee8771bcb09c9ae82256 (patch)
treeae616149f586b552e8bd0cf3b1479a8f5f2c2323 /worker
parent27425c15c4b96f1e11db8cc496b48f3d0fc0d3f4 (diff)
downloadaerc-318f7d252c6daa9c44b8ee8771bcb09c9ae82256.tar.gz
notmuch: fix cursor movement in threaded view
Set the SkipSort flag when sending directory infos for counting purposes. Without this, the directory infos would trigger a directory fetch which could bring the notmuch threads out of sync with the message list. The notmuch backend sends these directory infos automatically every minute. To reproduce the weird cursor movement in notmuch's threaded view: 1. enter threaded view in notmuch 2. wait 1 min (until the auto directory infos are sent out) 3. move cursor around and notice how it jumps over threads Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'worker')
-rw-r--r--worker/notmuch/eventhandlers.go2
-rw-r--r--worker/notmuch/worker.go6
2 files changed, 7 insertions, 1 deletions
diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go
index 4eec1f60..7b3c5174 100644
--- a/worker/notmuch/eventhandlers.go
+++ b/worker/notmuch/eventhandlers.go
@@ -16,7 +16,7 @@ func (w *worker) handleNotmuchEvent(et eventType) error {
func (w *worker) handleUpdateDirCounts(ev eventType) error {
for name, query := range w.nameQueryMap {
- info, err := w.gatherDirectoryInfo(name, query)
+ info, err := w.buildDirInfo(name, query, true)
if err != nil {
logging.Errorf("could not gather DirectoryInfo: %v", err)
continue
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 6941809a..28029b26 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -212,11 +212,17 @@ func (w *worker) handleListDirectories(msg *types.ListDirectories) error {
func (w *worker) gatherDirectoryInfo(name string, query string) (
*types.DirectoryInfo, error) {
+ return w.buildDirInfo(name, query, false)
+}
+
+func (w *worker) buildDirInfo(name string, query string, skipSort bool) (
+ *types.DirectoryInfo, error) {
count, err := w.db.QueryCountMessages(query)
if err != nil {
return nil, err
}
info := &types.DirectoryInfo{
+ SkipSort: skipSort,
Info: &models.DirectoryInfo{
Name: name,
Flags: []string{},