commit 96decd2392ce72c9fee10d748be06dd96ba7d1ea parent 73f7b696549e82b7a32a189ae6d1c496e25e5b22 Author: William Casarin <jb55@jb55.com> Date: Mon, 13 Mar 2023 11:49:51 -0600 Revert "Fix mentions not working in middle of new note" This breaks other things, the autocomplete doesn't go away after tag selection now This reverts commit 1e7d9a6373d359b498faafc5f7680babed2e5030. Diffstat:
M | damus/Views/PostView.swift | | | 12 | ++++++++---- |
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift @@ -170,20 +170,24 @@ struct PostView: View { } func get_searching_string(_ post: String) -> String? { - guard let handle = post.components(separatedBy: .whitespacesAndNewlines).first(where: {$0.first == "@"}) else { + guard let last_word = post.components(separatedBy: .whitespacesAndNewlines).last else { return nil } - guard handle.count >= 2 else { + guard last_word.count >= 2 else { + return nil + } + + guard last_word.first! == "@" else { return nil } // don't include @npub... strings - guard handle.count != 64 else { + guard last_word.count != 64 else { return nil } - return String(handle.dropFirst()) + return String(last_word.dropFirst()) } struct PostView_Previews: PreviewProvider {