]> git.marmaro.de Git - mmh/commitdiff
update unseen sequence after display
authorPhilipp Takacs <philipp@bureaucracy.de>
Sun, 15 Dec 2019 13:44:57 +0000 (14:44 +0100)
committerPhilipp Takacs <philipp@bureaucracy.de>
Thu, 26 Mar 2020 20:36:00 +0000 (21:36 +0100)
before this patch, if messages are displaied with a pager and during
that time a new message comes to the folder. The new message is added
to the unseen sequence. But after closing the pager the unseen sequence
gets overwritten and the new message is removed from the unseen
sequence.

Now the sequence file gets reread before remove the shown messages
from the unseen sequenece.

test/common.sh
test/tests/show/test-unseen-update [new file with mode: 0644]
uip/mhshow.c

index b869d56dfed711f55fa77e1ddc7c68c3d14e44e0..9e6cb2269cebb0a0b7a08b55a43f102c87e22e86 100644 (file)
@@ -8,6 +8,17 @@ trap '
 ' 0 1 2 15
 failed=0
 
+#fake sleeps 60 secounds and then reads all input
+mmh_test_fakepager()
+{
+       sleep 60
+
+       while read a
+       do
+               sleep 0
+       done
+       exit 0
+}
 
 test_skip()
 {
diff --git a/test/tests/show/test-unseen-update b/test/tests/show/test-unseen-update
new file mode 100644 (file)
index 0000000..a4875c4
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+######################################################
+#
+# Test change of sequence during show
+#
+######################################################
+
+. "$MH_TEST_COMMON"
+
+mark -sequence u -add -nozero 1-9
+show 1-8 | mmh_test_fakepager &
+pagerpid=$!
+
+#because the fakepager sleeps 60 secounds the unseen sequence should be unchainged
+#this can fail if the buffer of the pipe is big enouth to hold all messages
+runandcheck "pick u" <<!
+1
+2
+3
+4
+5
+6
+7
+8
+9
+!
+mark -sequence u -add -nozero 10
+runandcheck "pick u" <<!
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+!
+pkill -P $pagerpid
+wait $pagerpid
+
+runandcheck "pick u" <<!
+9
+10
+!
index 6978454e53fb08bad29ee5d5a01988765b1e361b..2a62777a4bd36b7086e6cab8929a2bc2d8c788eb 100644 (file)
@@ -301,8 +301,6 @@ main(int argc, char **argv)
                        if (is_selected(mp, msgnum))
                                set_unseen(mp, msgnum);
 
-               seq_setunseen(mp, 0);  /* unset unseen seqs for shown msgs */
-
                cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
                ctp = cts;
 
@@ -363,6 +361,8 @@ main(int argc, char **argv)
 
        /* If reading from a folder, do some updating */
        if (mp) {
+               seq_read(mp);
+               seq_setunseen(mp, 0);  /* unset unseen seqs for shown msgs */
                context_replace(curfolder, folder); /* update current folder */
                seq_setcur(mp, mp->hghsel);        /* update current message */
                seq_save(mp);                      /* synchronize sequences */