mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Replace selection on insert template
This commit is contained in:
parent
90d1af3401
commit
ccc782be35
1 changed files with 16 additions and 5 deletions
|
@ -1636,13 +1636,24 @@ public class FragmentCompose extends FragmentBase {
|
|||
}, null, getContext());
|
||||
|
||||
int start = etBody.getSelectionStart();
|
||||
if (start < 0) {
|
||||
start = etBody.length() - 1;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
int end = etBody.getSelectionEnd();
|
||||
if (start > end) {
|
||||
int tmp = start;
|
||||
start = end;
|
||||
end = tmp;
|
||||
}
|
||||
|
||||
etBody.getText().insert(start, spanned);
|
||||
if (start >= 0 && start < end)
|
||||
etBody.getText().replace(start, end, spanned);
|
||||
else {
|
||||
if (start < 0) {
|
||||
start = etBody.length() - 1;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
}
|
||||
|
||||
etBody.getText().insert(start, spanned);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue