Fix #498
This commit is contained in:
parent
bb08d6585c
commit
87ce6b8bb1
|
@ -527,6 +527,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
|||
|
||||
mainEditText.setSelectionListener(this);
|
||||
mainEditText.addTextChangedListener(new TextWatcher(){
|
||||
private int lastChangeStart, lastChangeCount;
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after){
|
||||
|
||||
|
@ -536,6 +538,14 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
|||
public void onTextChanged(CharSequence s, int start, int before, int count){
|
||||
if(s.length()==0)
|
||||
return;
|
||||
lastChangeStart=start;
|
||||
lastChangeCount=count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s){
|
||||
int start=lastChangeStart;
|
||||
int count=lastChangeCount;
|
||||
// offset one char back to catch an already typed '@' or '#' or ':'
|
||||
int realStart=start;
|
||||
start=Math.max(0, start-1);
|
||||
|
@ -581,10 +591,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
|||
editable.removeSpan(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s){
|
||||
updateCharCounter();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue