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

This commit is contained in:
vaw
2025-10-25 19:54:16 +00:00
committed by GitHub
parent 14aa97251c
commit d44f861871

View File

@@ -727,22 +727,28 @@ impl<'a> MessageFormatter<'a> {
info: &'a RoomInfo, info: &'a RoomInfo,
settings: &'a ApplicationSettings, settings: &'a ApplicationSettings,
) -> Option<ProtocolPreview<'a>> { ) -> Option<ProtocolPreview<'a>> {
let reply_style = if settings.tunables.message_user_color {
style.patch(settings.get_user_color(&msg.sender))
} else {
style
};
let width = self.width(); let width = self.width();
let w = width.saturating_sub(2); let w = width.saturating_sub(2);
let (mut replied, proto) = msg.show_msg(w, style, true, settings); let (mut replied, proto) = msg.show_msg(w, reply_style, true, settings);
let mut sender = msg.sender_span(info, self.settings); let mut sender = msg.sender_span(info, self.settings);
let sender_width = UnicodeWidthStr::width(sender.content.as_ref()); let sender_width = UnicodeWidthStr::width(sender.content.as_ref());
let trailing = w.saturating_sub(sender_width + 1); let trailing = w.saturating_sub(sender_width + 1);
sender.style = sender.style.patch(style); sender.style = sender.style.patch(reply_style);
self.push_spans( self.push_spans(
Line::from(vec![ Line::from(vec![
Span::styled(" ", style), Span::styled(" ", style),
Span::styled(THICK_VERTICAL, style), Span::styled(THICK_VERTICAL, style),
sender, sender,
Span::styled(":", style), Span::styled(":", reply_style),
space_span(trailing, style), space_span(trailing, reply_style),
]), ]),
style, style,
text, text,
@@ -761,7 +767,7 @@ impl<'a> MessageFormatter<'a> {
line.spans.insert(0, Span::styled(" ", style)); line.spans.insert(0, Span::styled(" ", style));
} }
self.push_text(replied, style, text); self.push_text(replied, reply_style, text);
proto proto
} }