Mark pasted text as inserted

This commit is contained in:
M66B 2024-02-20 14:52:47 +01:00
parent 42ac5fdcba
commit 7f81c1c7d3
1 changed files with 14 additions and 1 deletions

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;