File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Sources/StreamChatSwiftUI/ChatChannel/Composer/Suggestions
StreamChatSwiftUITests/Tests/ChatChannel/Suggestions Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1111### 🐞 Fixed
1212- Channel actions popup wrong appearance using a custom ` NavigationView `
1313- Channel list automatic channel selection disabled for compact iPad screen size
14+ - Mentions of users available in a new line
1415
1516# [ 4.28.0] ( https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.28.0 )
1617_ February 28, 2023_
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public struct TypingSuggester {
9898 let charIndexBeforeSymbol = firstSymbolBeforeCaret. lowerBound - 1
9999 let charRangeBeforeSymbol = NSRange ( location: charIndexBeforeSymbol, length: 1 )
100100 let textBeforeSymbol = charIndexBeforeSymbol >= 0 ? textString. substring ( with: charRangeBeforeSymbol) : " "
101- guard textBeforeSymbol. isEmpty || textBeforeSymbol == " " else {
101+ guard textBeforeSymbol. isEmpty || textBeforeSymbol == " " || textBeforeSymbol == " \n " else {
102102 return nil
103103 }
104104
Original file line number Diff line number Diff line change @@ -133,6 +133,24 @@ class TypingSuggester_Tests: XCTestCase {
133133 XCTAssert ( suggestion? . text == " Mar " )
134134 XCTAssert ( suggestion? . locationRange == NSRange ( location: 5 , length: 3 ) )
135135 }
136+
137+ func test_typingSuggester_newLine( ) {
138+ // Given
139+ let options = TypingSuggestionOptions ( symbol: " @ " )
140+ let typingSuggester = TypingSuggester ( options: options)
141+ let string = " \n @Mar "
142+ let caretLocation = 5
143+
144+ // When
145+ let suggestion = typingSuggester. typingSuggestion (
146+ in: string,
147+ caretLocation: caretLocation
148+ )
149+
150+ // Then
151+ XCTAssert ( suggestion? . text == " Mar " )
152+ XCTAssert ( suggestion? . locationRange == NSRange ( location: 2 , length: 3 ) )
153+ }
136154
137155 func test_typingSuggester_onlyOnStartAllowed( ) {
138156 // Given
You can’t perform that action at this time.
0 commit comments