damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit b532dc48e1b5ba09c0c9578d6aa982ad649e1561
parent 7bf18336d023f7ad1ea3043f4a0134d0af5c9c3c
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  5 Apr 2023 13:30:05 -0700

Also trim whitespace before single note refs

Diffstat:
Mdamus/Views/NoteContentView.swift | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift @@ -275,9 +275,15 @@ func render_blocks(blocks: [Block], profiles: Profiles, privkey: String?) -> Not if let prev = blocks[safe: ind-1], case .url(let u) = prev, is_image_url(u) { trimmed = " " + trim_prefix(trimmed) } - if let next = blocks[safe: ind+1], case .url(let u) = next, is_image_url(u) { - trimmed = trim_suffix(trimmed) + + if let next = blocks[safe: ind+1] { + if case .url(let u) = next, is_image_url(u) { + trimmed = trim_suffix(trimmed) + } else if case .mention(let m) = next, m.type == .event, one_note_ref { + trimmed = trim_suffix(trimmed) + } } + return str + AttributedString(stringLiteral: trimmed) case .hashtag(let htag): return str + hashtag_str(htag)