This commit is contained in:
Grishka 2022-04-30 20:30:29 +03:00
parent 38eadca4e2
commit ec38210dde
1 changed files with 3 additions and 1 deletions

View File

@ -382,6 +382,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count){ 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 ':' // offset one char back to catch an already typed '@' or '#' or ':'
int realStart=start; int realStart=start;
start=Math.max(0, start-1); start=Math.max(0, start-1);
@ -1064,7 +1066,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
@Override @Override
public void onSelectionChanged(int start, int end){ 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); ComposeAutocompleteSpan[] spans=mainEditText.getText().getSpans(start, end, ComposeAutocompleteSpan.class);
if(spans.length>0){ if(spans.length>0){
assert spans.length==1; assert spans.length==1;