summaryrefslogtreecommitdiffstats
path: root/docs/superpowers/plans
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-04 10:49:02 +0200
committerDanilo M. <danix@danix.xyz>2026-08-04 12:54:43 +0200
commite19e2318fc637d50b86f663b21bd97494057232d (patch)
tree28cd5e183511959abdc4a49ab19afda458c18d4a /docs/superpowers/plans
parentf762e4ca0051a7a34123b5a526696f2feb5c6e03 (diff)
downloadqtmaildir-e19e2318fc637d50b86f663b21bd97494057232d.tar.gz
qtmaildir-e19e2318fc637d50b86f663b21bd97494057232d.zip
feat(threads): mark an opened thread read after a delay
Opening a thread left it tagged unread, so the unread count never matched what had actually been read and the app was quietly wrong every day it was used. Item 6 of the usability backlog. A single-shot timer, armed when a thread is selected and restarted rather than stacked, so arrowing down a list marks only the thread still selected when it fires and not every one passed through. Configurable through mark_read_delay_ms in [general], defaulting to 2000: zero marks read at once, and any negative value disables the behaviour, which is why the value is neither clamped nor warned about at either end. The automatic change deliberately does NOT go on the undo stack. It routes through sendThreadTagChange() rather than tagSelected(), because undoing an action the user never took is worse than leaving a thread read, and toggle_unread already gives them a direct way back. It still funnels through the single applyTags path; what differs is only whether the inverse is pushed, which is a window-level decision above the worker. An explicit toggle_unread cancels any pending timer, or marking a thread unread by hand would be reversed a moment later and the key would look broken. Two guards beyond the plan, both from asking what happens when a timer outlives the thread it was armed for. Arming is skipped for a thread that is not unread, so no write is scheduled that would change nothing, and the handler re-checks that its thread is still selected and still unread before writing, so a stale timer does nothing rather than tagging the wrong thread. The plan expected the rapid-arrow case to need a database and a manual check. It needs neither: ThreadListModel takes threads through appendBatch(), so the case is unit-tested. All three tests were confirmed to fail against deliberately broken versions, one arming for read threads and one creating a timer per selection instead of restarting one. Item 7 is closed in the same pass. The user verified against real mail that HTML messages already open as HTML, which is what the item asked for, so it is recorded as done with no code changed. The prefer_html key it floated was not added: nobody has asked to default to plain text, and Ctrl+H already switches a thread by hand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'docs/superpowers/plans')
-rw-r--r--docs/superpowers/plans/2026-08-03-post-0.1.0-usability.md48
1 files changed, 46 insertions, 2 deletions
diff --git a/docs/superpowers/plans/2026-08-03-post-0.1.0-usability.md b/docs/superpowers/plans/2026-08-03-post-0.1.0-usability.md
index 35d5937..417a980 100644
--- a/docs/superpowers/plans/2026-08-03-post-0.1.0-usability.md
+++ b/docs/superpowers/plans/2026-08-03-post-0.1.0-usability.md
@@ -45,8 +45,8 @@ taking that too literally.
| 3 | Too few clickable affordances, shortcuts are the only route | discoverability | M | **done** |
| 4 | Message-pane font size does not survive restart | persistence | S | **done** |
| 5 | Thread list is cramped, poor readability | presentation | S | open |
-| 6 | Opened message stays unread | behavior | S | open |
-| 7 | HTML view should be default for HTML messages | behavior | XS | **verify first, may already be done** |
+| 6 | Opened message stays unread | behavior | S | **done** |
+| 7 | HTML view should be default for HTML messages | behavior | XS | **done** (already worked) |
| 8 | No buttons or menu entries for archive, undo, etc | discoverability | M | **done** |
| 9 | No in-app view of configured shortcuts | discoverability | S | **done** |
| 10 | Reaching an account's inbox takes two steps | workflow | S | **postponed** (partly done) |
@@ -438,6 +438,35 @@ become read.
`NotmuchWorker` tests already build, but the timer logic itself is UI-side and
easier to check by hand. At minimum, verify the rapid-arrow case manually.
+### Outcome (done)
+
+Built as specced, including every decision recorded above: a 2000 ms default,
+`mark_read_delay_ms` in `[general]`, the automatic change kept off the undo
+stack via `sendThreadTagChange()`, and an explicit `toggle_unread` cancelling
+any pending timer.
+
+**The rapid-arrow case is unit-tested, not left to hand-checking.** The plan
+expected it to need a database and a person; it needs neither. `ThreadListModel`
+takes threads directly through `appendBatch()`, so a test builds three unread
+rows, arrows through them, and asserts one timer stays armed. The timer carries
+an object name so the test observes it through `findChild` rather than the
+window exposing it.
+
+**The three tests were verified by breaking the code**, since a passing test
+proves nothing until it has been seen to fail:
+
+- Removing the already-read check arms a timer for a read thread, caught.
+- Creating a fresh timer per selection instead of restarting one, which is
+ precisely the stacking the plan warns about, fails two of the three.
+
+**Two guards the plan did not call for**, both from asking what happens when
+the timer outlives its thread. `scheduleMarkRead()` refuses to arm for a thread
+that is not unread, so a read thread never schedules a write that would change
+nothing. `markCurrentThreadRead()` re-checks that the thread it was armed for
+is still selected AND still unread before writing, so a timer that survives a
+selection change or a manual toggle does nothing rather than tagging the wrong
+thread.
+
## 7. HTML view should be default for HTML messages
**Verify before doing anything.** `MessageView::m_preferHtml` is already
@@ -462,6 +491,21 @@ worth adding for people who want plain text by default.
section of `CLAUDE.md`. Preferring HTML is orthogonal to remote content, which
stays blocked and per-render.
+### Outcome (done, 2026-08-04): nothing was broken
+
+**Verified by the user against real mail: HTML messages do open as HTML.** The
+item was raised on an observation that could not be reproduced afterwards, and
+the code was already correct: `m_preferHtml` initialises to `true` and `clear()`
+resets it to `true`, so every thread starts in `PreferHtml`.
+
+No code changed. Recorded as done rather than dropped, since the behaviour the
+item asked for is the behaviour that ships.
+
+The `prefer_html` config key the item floated for people who want plain text by
+default was **not** added: nobody has asked for it, and `toggle_html`
+(`Ctrl+H`) already switches a thread by hand. Add it if someone wants the
+default flipped, not before.
+
## 10. Reaching an account's inbox takes two steps
**Observed:** select account from the dropdown, then click inbox or unread.