commit | 2ad83dc780394105f0f38b7b01b23f5de40cd3dd | [log] [tgz] |
---|---|---|
author | Grant Toepfer <grantapher@google.com> | Wed Feb 07 13:50:56 2024 -0800 |
committer | Grant Toepfer <grantapher@google.com> | Mon Feb 12 18:41:14 2024 +0000 |
tree | 55d9fb4d4b845e6e30e27577300db495c5840b78 | |
parent | 73f32edc563c651bd98f69b50ad0a9e1e263697e [diff] [blame] |
Clear selection on selectable change When the underlying text of a selection changed, the selection was not updated causing the content and selection to be out of sync. Instead, we will now simply clear the selection when the underlying text changes. Test: SelectionCopyTest Fixes: b/322066508 Change-Id: Iee0bdd28b78967290696440e747427f4e182bf8c
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt index 87a3f18..5808ef2 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt
@@ -304,6 +304,8 @@ currentDragPosition = null } + // This function is meant to handle changes in the selectable content, + // such as the text changing. selectionRegistrar. selectableKey -> if (selectableKey in selectionRegistrar.subselections) { // Clear the selection range of each Selectable.