From 9f01cab2be68d665005d7bb626a2f9d875e938ad Mon Sep 17 00:00:00 2001 From: William Casarin Date: Tue, 8 Aug 2023 17:04:49 -0700 Subject: [PATCH] simplify reduce_text_block --- damus/Views/NoteContentView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift index d8cc9766..f41483a1 100644 --- a/damus/Views/NoteContentView.swift +++ b/damus/Views/NoteContentView.swift @@ -417,7 +417,7 @@ fileprivate func artifact_part_last_text_ind(parts: [ArtifactPart]) -> (Int, Tex return (ind, txt) } -func reduce_text_block(blocks: [Block], ind: Int, txt: String, one_note_ref: Bool) -> CompatibleText { +func reduce_text_block(blocks: [Block], ind: Int, txt: String, one_note_ref: Bool) -> String { var trimmed = txt if let prev = blocks[safe: ind-1], @@ -436,7 +436,7 @@ func reduce_text_block(blocks: [Block], ind: Int, txt: String, one_note_ref: Boo } } - return CompatibleText(stringLiteral: trimmed) + return trimmed } func render_blocks(blocks bs: Blocks, profiles: Profiles) -> NoteArtifactsSeparated { @@ -459,8 +459,8 @@ func render_blocks(blocks bs: Blocks, profiles: Profiles) -> NoteArtifactsSepara } return str + mention_str(m, profiles: profiles) case .text(let txt): - return str + reduce_text_block(blocks: blocks, ind: ind, txt: txt, one_note_ref: one_note_ref) - + return str + CompatibleText(stringLiteral: reduce_text_block(blocks: blocks, ind: ind, txt: txt, one_note_ref: one_note_ref)) + case .relay(let relay): return str + CompatibleText(stringLiteral: relay)