mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-28 07:48:13 +00:00
The per-channel unread counter was independent of the ring's actual contents, so the two drifted apart: - Opening a channel whose entries had been evicted left the badge claiming messages the list could no longer show. The viewing-session bookkeeping computes the count from an _unread_at_entry snapshot, and with an empty list _hist_visible is 0, so entering only knocked the count down by one instead of clearing it (badge "7", empty list, then "6"). - Eviction from a full ring decremented the counter for any dropped entry, including already-read ones, undercounting the newer unread messages the counter actually refers to. chUnread()/getTotalChannelUnread() now clamp to the channel's ring occupancy, so the badge can never promise more than the history holds whatever the raw counter says, and eviction only decrements when the entry being dropped was itself unread. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>