Commit d44f861871

d44f861871854a92fcf286dd60d494e15ac640b9

parent: 14aa97251c

Unregistered key

vaw <git@nlih.de> · 2025-10-25 19:54 UTC
committer: <noreply@github.com>

Respect user color of replied message with `message_user_color` (#532)

Layout: unified · split

src/message/mod.rs +11 −5
@@ -727,22 +727,28 @@ impl<'a> MessageFormatter<'a> {
727 info: &'a RoomInfo, 727 info: &'a RoomInfo,
728 settings: &'a ApplicationSettings, 728 settings: &'a ApplicationSettings,
729 ) -> Option<ProtocolPreview<'a>> { 729 ) -> Option<ProtocolPreview<'a>> {
730 let reply_style = if settings.tunables.message_user_color {
731 style.patch(settings.get_user_color(&msg.sender))
732 } else {
733 style
734 };
735
730 let width = self.width(); 736 let width = self.width();
731 let w = width.saturating_sub(2); 737 let w = width.saturating_sub(2);
732 let (mut replied, proto) = msg.show_msg(w, style, true, settings); 738 let (mut replied, proto) = msg.show_msg(w, reply_style, true, settings);
733 let mut sender = msg.sender_span(info, self.settings); 739 let mut sender = msg.sender_span(info, self.settings);
734 let sender_width = UnicodeWidthStr::width(sender.content.as_ref()); 740 let sender_width = UnicodeWidthStr::width(sender.content.as_ref());
735 let trailing = w.saturating_sub(sender_width + 1); 741 let trailing = w.saturating_sub(sender_width + 1);
736 742
737 sender.style = sender.style.patch(style); 743 sender.style = sender.style.patch(reply_style);
738 744
739 self.push_spans( 745 self.push_spans(
740 Line::from(vec![ 746 Line::from(vec![
741 Span::styled(" ", style), 747 Span::styled(" ", style),
742 Span::styled(THICK_VERTICAL, style), 748 Span::styled(THICK_VERTICAL, style),
743 sender, 749 sender,
744 Span::styled(":", style), 750 Span::styled(":", reply_style),
745 space_span(trailing, style), 751 space_span(trailing, reply_style),
746 ]), 752 ]),
747 style, 753 style,
748 text, 754 text,
@@ -761,7 +767,7 @@ impl<'a> MessageFormatter<'a> {
761 line.spans.insert(0, Span::styled(" ", style)); 767 line.spans.insert(0, Span::styled(" ", style));
762 } 768 }
763 769
764 self.push_text(replied, style, text); 770 self.push_text(replied, reply_style, text);
765 771
766 proto 772 proto
767 } 773 }