mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 10:17:18 +00:00
Mark pasted text as inserted
This commit is contained in:
parent
42ac5fdcba
commit
7f81c1c7d3
1 changed files with 14 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue