Skip to content

Commit

Permalink
Trim newlines from message previews. (#1208)
Browse files Browse the repository at this point in the history
- Fixes a bug with replies where the message shows on the line after the sender's name.
  • Loading branch information
pixlwave committed Jun 29, 2023
1 parent ce7ca32 commit ba79d7f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ struct RoomEventStringBuilder {
}

func prefix(_ eventSummary: String, with sender: TimelineItemSender) -> AttributedString {
let attributedEventSummary = AttributedString(eventSummary.trimmingCharacters(in: .whitespacesAndNewlines))
if let senderDisplayName = sender.displayName,
let attributedSenderDisplayName = try? AttributedString(markdown: "**\(senderDisplayName)**") {
// Don't include the message body in the markdown otherwise it makes tappable links.
return attributedSenderDisplayName + ": " + AttributedString(eventSummary)
return attributedSenderDisplayName + ": " + attributedEventSummary
} else {
return AttributedString(eventSummary)
return attributedEventSummary
}
}
}

0 comments on commit ba79d7f

Please sign in to comment.