From c4f5a2cd675d542e397d082ec0033365a61aaede Mon Sep 17 00:00:00 2001 From: Tatiana Elfimova Date: Fri, 17 Oct 2025 15:19:27 +0200 Subject: [PATCH] [platform UI] IJPL-188268 Search Everywhere: result selection gets lost on the popup reopening - Code review fixes GitOrigin-RevId: f8b6f020aeee69762de73b802a0598bc623a5bdc --- .../frontend/src/ui/SePopupContentPane.kt | 3 +-- .../searchEverywhere/frontend/src/ui/SeResultJBList.kt | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/platform/searchEverywhere/frontend/src/ui/SePopupContentPane.kt b/platform/searchEverywhere/frontend/src/ui/SePopupContentPane.kt index 83ebdf14441a..3c3c96ead547 100644 --- a/platform/searchEverywhere/frontend/src/ui/SePopupContentPane.kt +++ b/platform/searchEverywhere/frontend/src/ui/SePopupContentPane.kt @@ -988,9 +988,8 @@ class SePopupContentPane( private fun autoSelectIndex(searchPattern: String, isEndEvent: Boolean) { val indexToSelect = selectionListener.getIndexToSelect(getMaxVisibleRowCount(), searchPattern, textField.isInitialSearchPattern, isEndEvent) - if (indexToSelect != -1 && indexToSelect < resultListModel.size()) { + if (indexToSelect != -1 && indexToSelect < resultListModel.size() && indexToSelect != resultList.selectedIndex) { resultList.autoSelectIndex(indexToSelect) - ScrollingUtil.ensureIndexIsVisible(resultList, resultList.selectedIndex, 1) } } diff --git a/platform/searchEverywhere/frontend/src/ui/SeResultJBList.kt b/platform/searchEverywhere/frontend/src/ui/SeResultJBList.kt index 56cea1bffb6b..f0a33dc29e0e 100644 --- a/platform/searchEverywhere/frontend/src/ui/SeResultJBList.kt +++ b/platform/searchEverywhere/frontend/src/ui/SeResultJBList.kt @@ -8,10 +8,8 @@ import javax.swing.ListModel @ApiStatus.Internal class SeResultJBList(model: ListModel) : JBList(model) { - - private var _isAutoSelectionChange: Boolean = false - val isAutoSelectionChange: Boolean - get() = _isAutoSelectionChange + var isAutoSelectionChange: Boolean = false + private set /** * Returns the number of items in the result list, excluding the loading indicator. @@ -31,8 +29,8 @@ class SeResultJBList(model: ListModel) : JBList(model @RequiresEdt fun autoSelectIndex(index: Int) { - _isAutoSelectionChange = true + isAutoSelectionChange = true selectedIndex = index - _isAutoSelectionChange = false + isAutoSelectionChange = false } } \ No newline at end of file