diff --git a/src/main/kotlin/org/jetbrains/plugins/template/components/SearchBarWithAutoCompletion.kt b/src/main/kotlin/org/jetbrains/plugins/template/components/SearchBarWithAutoCompletion.kt index 2347deb..6a52110 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/components/SearchBarWithAutoCompletion.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/components/SearchBarWithAutoCompletion.kt @@ -58,6 +58,10 @@ internal fun SearchBarWithAutoCompletion( snapshotFlow { textFieldState.text.toString() } .distinctUntilChanged() .collect { searchTerm -> + if (searchTerm.isEmpty()) { + onClear() + } + popupController.onQueryChanged(searchTerm) } } @@ -81,7 +85,6 @@ internal fun SearchBarWithAutoCompletion( trailingIcon = { if (!isInputFieldEmpty) { CloseIconButton { - onClear() textFieldState.setTextAndPlaceCursorAtEnd("") } }