From ec38210ddee6adf712dcef17b72e37dcb570b3ea Mon Sep 17 00:00:00 2001 From: Grishka Date: Sat, 30 Apr 2022 20:30:29 +0300 Subject: [PATCH] Fix #99 --- .../org/joinmastodon/android/fragments/ComposeFragment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index fa91117c..ad3e2360 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -382,6 +382,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr @Override public void onTextChanged(CharSequence s, int start, int before, int count){ + if(s.length()==0) + return; // offset one char back to catch an already typed '@' or '#' or ':' int realStart=start; start=Math.max(0, start-1); @@ -1064,7 +1066,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr @Override public void onSelectionChanged(int start, int end){ - if(start==end){ + if(start==end && mainEditText.length()>0){ ComposeAutocompleteSpan[] spans=mainEditText.getText().getSpans(start, end, ComposeAutocompleteSpan.class); if(spans.length>0){ assert spans.length==1;