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 {
869 869
870#[derive(Clone, Debug, Default, Eq, PartialEq)] 870#[derive(Clone, Debug, Default, Eq, PartialEq)]
871pub struct UnreadInfo { 871pub struct UnreadInfo {
872 pub(crate) unread_mark: bool,
872 pub(crate) unread_messages: u64, 873 pub(crate) unread_messages: u64,
873 pub(crate) unread_notifications: u64, 874 pub(crate) unread_notifications: u64,
874 pub(crate) unread_mentions: u64, 875 pub(crate) unread_mentions: u64,
@@ -877,7 +878,7 @@ pub struct UnreadInfo {
877 878
878impl UnreadInfo { 879impl UnreadInfo {
879 pub fn is_unread(&self) -> bool { 880 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
881 } 882 }
882 883
883 pub fn has_mention(&self) -> bool { 884 pub fn has_mention(&self) -> bool {
@@ -1285,6 +1286,7 @@ impl RoomInfo {
1285 .find(|(_, msg)| !matches!(&msg.event, MessageEvent::State(..))); 1286 .find(|(_, msg)| !matches!(&msg.event, MessageEvent::State(..)));
1286 1287
1287 UnreadInfo { 1288 UnreadInfo {
1289 unread_mark: room.is_marked_unread(),
1288 unread_messages: room.num_unread_messages(), 1290 unread_messages: room.num_unread_messages(),
1289 unread_notifications: room.num_unread_notifications(), 1291 unread_notifications: room.num_unread_notifications(),
1290 unread_mentions: room.num_unread_mentions(), 1292 unread_mentions: room.num_unread_mentions(),
src/windows/mod.rs +4 −1
@@ -143,7 +143,7 @@ fn name_and_labels<'a>(
143 143
144 if unread.unread_mentions > 0 { 144 if unread.unread_mentions > 0 {
145 labels.push(vec![Span::styled("Unread Mention", style)]); 145 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() {
147 labels.push(vec![Span::styled("Unread", style)]); 147 labels.push(vec![Span::styled("Unread", style)]);
148 } 148 }
149 149
@@ -1816,6 +1816,7 @@ mod tests {
1816 name: "Room 1", 1816 name: "Room 1",
1817 unread: UnreadInfo { 1817 unread: UnreadInfo {
1818 latest: None, 1818 latest: None,
1819 unread_mark: false,
1819 unread_messages: 0, 1820 unread_messages: 0,
1820 unread_notifications: 0, 1821 unread_notifications: 0,
1821 unread_mentions: 0, 1822 unread_mentions: 0,
@@ -1830,6 +1831,7 @@ mod tests {
1830 name: "Room 2", 1831 name: "Room 2",
1831 unread: UnreadInfo { 1832 unread: UnreadInfo {
1832 latest: Some(MessageTimeStamp::OriginServer(40u32.into())), 1833 latest: Some(MessageTimeStamp::OriginServer(40u32.into())),
1834 unread_mark: false,
1833 unread_messages: 0, 1835 unread_messages: 0,
1834 unread_notifications: 0, 1836 unread_notifications: 0,
1835 unread_mentions: 0, 1837 unread_mentions: 0,
@@ -1844,6 +1846,7 @@ mod tests {
1844 name: "Room 3", 1846 name: "Room 3",
1845 unread: UnreadInfo { 1847 unread: UnreadInfo {
1846 latest: Some(MessageTimeStamp::OriginServer(20u32.into())), 1848 latest: Some(MessageTimeStamp::OriginServer(20u32.into())),
1849 unread_mark: false,
1847 unread_messages: 0, 1850 unread_messages: 0,
1848 unread_notifications: 0, 1851 unread_notifications: 0,
1849 unread_mentions: 0, 1852 unread_mentions: 0,