mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform UI] IJPL-188268 Search Everywhere: result selection gets lost on the popup reopening
- Code review fixes GitOrigin-RevId: f8b6f020aeee69762de73b802a0598bc623a5bdc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0007ce2510
commit
c4f5a2cd67
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,8 @@ import javax.swing.ListModel
|
||||
|
||||
@ApiStatus.Internal
|
||||
class SeResultJBList<E : SeResultListRow>(model: ListModel<E>) : JBList<E>(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<E : SeResultListRow>(model: ListModel<E>) : JBList<E>(model
|
||||
|
||||
@RequiresEdt
|
||||
fun autoSelectIndex(index: Int) {
|
||||
_isAutoSelectionChange = true
|
||||
isAutoSelectionChange = true
|
||||
selectedIndex = index
|
||||
_isAutoSelectionChange = false
|
||||
isAutoSelectionChange = false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user