1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Mark pasted text as inserted

This commit is contained in:
M66B 2024-02-20 14:52:47 +01:00
parent 42ac5fdcba
commit 7f81c1c7d3

View file

@ -369,7 +369,10 @@ public class EditTextCompose extends FixedEditText {
int start = getSelectionStart();
if (start < 0)
start = 0;
getText().insert(start, text.toString());
String plain = text.toString();
getText().insert(start, plain);
StyleHelper.markAsInserted(getText(), start, start + plain.length());
return true;
}
@ -611,6 +614,8 @@ public class EditTextCompose extends FixedEditText {
getText().insert(start, ssb);
else
getText().replace(start, end, ssb);
StyleHelper.markAsInserted(getText(), start, start + ssb.length());
} catch (Throwable ex) {
Log.e(ex);
/*
@ -633,6 +638,14 @@ public class EditTextCompose extends FixedEditText {
});
return true;
} else if (id == android.R.id.pasteAsPlainText) {
int start = getSelectionStart();
int length = length();
boolean pasted = super.onTextContextMenuItem(id);
int end = start + length() - length;
if (pasted && start >= 0 && end > start)
StyleHelper.markAsInserted(getText(), start, end);
return pasted;
} else if (id == android.R.id.undo && undo_manager) {
canUndo = true;
return true;