Commit 44d5f71b2d

44d5f71b2d169cc2e283d2ba385db2ea26732149

parent: 7afd68c6b2

Unregistered key

Ulyssa <git@ulyssa.dev> · 2026-08-15 05:16 UTC
committer: <noreply@github.com>

Show manually marked unread rooms in `:unreads` (#637)

Layout: unified · split

src/base.rs +3 −1
@@ -869,6 +869,7 @@ impl EventLocation {
869869
870870#[derive(Clone, Debug, Default, Eq, PartialEq)]
871871pub struct UnreadInfo {
872 pub(crate) unread_mark: bool,
872873 pub(crate) unread_messages: u64,
873874 pub(crate) unread_notifications: u64,
874875 pub(crate) unread_mentions: u64,
@@ -877,7 +878,7 @@ pub struct UnreadInfo {
877878
878879impl UnreadInfo {
879880 pub fn is_unread(&self) -> bool {
880 self.unread_notifications > 0 || self.unread_mentions > 0
881 self.unread_mark || self.unread_notifications > 0 || self.unread_mentions > 0
881882 }
882883
883884 pub fn has_mention(&self) -> bool {
@@ -1285,6 +1286,7 @@ impl RoomInfo {
12851286 .find(|(_, msg)| !matches!(&msg.event, MessageEvent::State(..)));
12861287
12871288 UnreadInfo {
1289 unread_mark: room.is_marked_unread(),
12881290 unread_messages: room.num_unread_messages(),
12891291 unread_notifications: room.num_unread_notifications(),
12901292 unread_mentions: room.num_unread_mentions(),
src/windows/mod.rs +4 −1
@@ -143,7 +143,7 @@ fn name_and_labels<'a>(
143143
144144 if unread.unread_mentions > 0 {
145145 labels.push(vec![Span::styled("Unread Mention", style)]);
146 } else if unread.unread_notifications > 0 || unread.unread_messages > 0 {
146 } else if unread.is_unread() {
147147 labels.push(vec![Span::styled("Unread", style)]);
148148 }
149149
@@ -1816,6 +1816,7 @@ mod tests {
18161816 name: "Room 1",
18171817 unread: UnreadInfo {
18181818 latest: None,
1819 unread_mark: false,
18191820 unread_messages: 0,
18201821 unread_notifications: 0,
18211822 unread_mentions: 0,
@@ -1830,6 +1831,7 @@ mod tests {
18301831 name: "Room 2",
18311832 unread: UnreadInfo {
18321833 latest: Some(MessageTimeStamp::OriginServer(40u32.into())),
1834 unread_mark: false,
18331835 unread_messages: 0,
18341836 unread_notifications: 0,
18351837 unread_mentions: 0,
@@ -1844,6 +1846,7 @@ mod tests {
18441846 name: "Room 3",
18451847 unread: UnreadInfo {
18461848 latest: Some(MessageTimeStamp::OriginServer(20u32.into())),
1849 unread_mark: false,
18471850 unread_messages: 0,
18481851 unread_notifications: 0,
18491852 unread_mentions: 0,