diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index b52aaf2f878..282367ffc39 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -9,6 +9,7 @@ import android.text.Html; import android.text.TextUtils; import android.text.TextWatcher; +import android.text.style.CharacterStyle; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -588,6 +589,12 @@ public void onTextChanged(final CharSequence s, final int start, @Override public void afterTextChanged(final Editable s) { + final CharacterStyle[] toBeRemovedSpans = s.getSpans( + 0, s.length(), CharacterStyle.class + ); + for (final CharacterStyle toBeRemovedSpan : toBeRemovedSpans) { + s.removeSpan(toBeRemovedSpan); + } final String newText = searchEditText.getText().toString(); suggestionPublisher.onNext(newText); }