mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-27 09:27:54 +00:00
Fix search highlight in multi-whitespace bodies.
The way the highlight was done could get screwed up if you had multiple whitespaces in a row. This particularly came up with messages with multiple newlines.
This commit is contained in:
@@ -23,6 +23,15 @@ public class SearchUtilTest {
|
||||
assertEquals(Arrays.asList(new Pair<>(0, 1)), result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighlightRanges_singleHighlightTokenWithNewLines() {
|
||||
String text = "123\n\n\nabc";
|
||||
String highlight = "a";
|
||||
List<Pair<Integer, Integer>> result = SearchUtil.getHighlightRanges(LOCALE, text, highlight);
|
||||
|
||||
assertEquals(Arrays.asList(new Pair<>(6, 7)), result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighlightRanges_multipleHighlightTokens() {
|
||||
String text = "a bc";
|
||||
|
Reference in New Issue
Block a user