From 5694a75a4ca3b9187d1d949d704c72ad795dcfa6 Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Mon, 25 Mar 2019 21:26:57 +0100 Subject: [PATCH] Fix word boundary detection in filters (#1152) --- .../com/keylesspalace/tusky/fragment/TimelineFragment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java index 20c1a330e..13847dfd0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java @@ -69,7 +69,6 @@ import com.keylesspalace.tusky.viewdata.StatusViewData; import java.util.ArrayList; import java.io.IOException; import java.util.Collections; -import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.ListIterator; @@ -369,7 +368,7 @@ public class TimelineFragment extends SFragment implements private static String filterToRegexToken(Filter filter) { String phrase = Pattern.quote(filter.getPhrase()); - return filter.getWholeWord() ? String.format("\\b%s\\b", phrase) : phrase; + return filter.getWholeWord() ? String.format("(^|\\W)%s($|\\W)", phrase) : phrase; } private void applyFilters(List filters, boolean refresh) {