Extend style to inserted text via paste or auto-correct regardless of content.

This commit is contained in:
Cody Henthorne
2023-06-30 14:05:35 -04:00
parent 11aac76fb6
commit fb4f41b996

View File

@@ -46,11 +46,17 @@ class ComposeTextStyleWatcher : TextWatcher {
try {
if (editStart < 0 || editEnd < 0 || editStart >= editEnd || (editStart == 0 && editEnd == s.length)) {
textSnapshotPriorToChange = null
return
}
val change = s.subSequence(editStart, editEnd)
if (change.isEmpty() || textSnapshotPriorToChange == null || (editEnd - editStart == 1 && !StringUtil.isVisuallyEmpty(change[0])) || TextUtils.equals(textSnapshotPriorToChange, change)) {
if (change.isEmpty() ||
textSnapshotPriorToChange == null ||
(editEnd - editStart == 1 && !StringUtil.isVisuallyEmpty(change[0])) ||
TextUtils.equals(textSnapshotPriorToChange, change) ||
editEnd - editStart > 1
) {
textSnapshotPriorToChange = null
return
}