Fix word boundary detection in filters (#1152)
This commit is contained in:
parent
291a923d51
commit
5694a75a4c
|
@ -69,7 +69,6 @@ import com.keylesspalace.tusky.viewdata.StatusViewData;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
@ -369,7 +368,7 @@ public class TimelineFragment extends SFragment implements
|
||||||
|
|
||||||
private static String filterToRegexToken(Filter filter) {
|
private static String filterToRegexToken(Filter filter) {
|
||||||
String phrase = Pattern.quote(filter.getPhrase());
|
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<Filter> filters, boolean refresh) {
|
private void applyFilters(List<Filter> filters, boolean refresh) {
|
||||||
|
|
Loading…
Reference in New Issue