mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[^yole] don't freeze and mark lookup items as preselected when lookup is not shown yet (IDEA-69590, IDEA-69259)
This commit is contained in:
@@ -761,7 +761,18 @@ public class Bar {
|
||||
assert myFixture.lookupElementStrings.containsAll(['private', 'protected'])
|
||||
}
|
||||
|
||||
public void testExactMatchesFirst() {
|
||||
myFixture.configureByText("a.java", """
|
||||
public class UTest {
|
||||
void nextWord() {}
|
||||
|
||||
void foo() {
|
||||
n<caret>
|
||||
}
|
||||
}""")
|
||||
type 'ew'
|
||||
assert myFixture.lookupElementStrings == ['new', 'nextWord']
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ import com.intellij.util.containers.ConcurrentHashMap;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.AsyncProcessIcon;
|
||||
import com.intellij.util.ui.ButtonlessScrollBarUI;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -384,11 +383,6 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
|
||||
final List<LookupElement> items = matchingItems(snapshot);
|
||||
|
||||
List<LookupElement> oldItems = getItems();
|
||||
if (oldItems.size() == items.size() && new THashSet<LookupElement>(items, TObjectHashingStrategy.IDENTITY).containsAll(oldItems)) {
|
||||
return;
|
||||
}
|
||||
|
||||
checkMinPrefixLengthChanges(items);
|
||||
|
||||
boolean hasPreselected = !mySelectionTouched && items.contains(myPreselectedItem);
|
||||
@@ -405,7 +399,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
|
||||
myPreferredItemsCount = model.size();
|
||||
myFrozenItems.clear();
|
||||
myFrozenItems.addAll(model);
|
||||
if (myShown) {
|
||||
myFrozenItems.addAll(model);
|
||||
}
|
||||
|
||||
model.addAll(addRemainingItemsLexicographically(model, items));
|
||||
|
||||
@@ -499,7 +495,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
myList.setSelectedIndex(doSelectMostPreferableItem(getItems()));
|
||||
}
|
||||
|
||||
if (myPreselectedItem != null) {
|
||||
if (myPreselectedItem != null && myShown) {
|
||||
myPreselectedItem = getCurrentItem();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user