diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 43a52cb523..0dce8918fc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -5193,10 +5193,18 @@ public class FragmentCompose extends FragmentBase { Log.i("Loaded action id=" + draft.id + " action=" + getActionName(action) + " encryption=" + needsEncryption); + int[] toPos = new int[]{etTo.getSelectionStart(), etTo.getSelectionEnd()}; + int[] ccPos = new int[]{etCc.getSelectionStart(), etCc.getSelectionEnd()}; + int[] bccPos = new int[]{etBcc.getSelectionStart(), etBcc.getSelectionEnd()}; + etTo.setText(MessageHelper.formatAddressesCompose(draft.to)); etCc.setText(MessageHelper.formatAddressesCompose(draft.cc)); etBcc.setText(MessageHelper.formatAddressesCompose(draft.bcc)); + etTo.setSelection(toPos[0], toPos[1]); + etCc.setSelection(ccPos[0], ccPos[1]); + etBcc.setSelection(bccPos[0], bccPos[1]); + Bundle extras = args.getBundle("extras"); boolean show = extras.getBoolean("show"); if (show) @@ -5556,11 +5564,6 @@ public class FragmentCompose extends FragmentBase { public void run() { try { target.requestFocus(); - if (target.getId() != R.id.etSubject && target.getId() != R.id.etBody) { - EditText et = (EditText) target; - String text = et.getText().toString(); - et.setSelection(text.length()); - } Context context = target.getContext();