when a lookup is just shown, scroll it to the selected item regardless whether it's autopopup or not

This commit is contained in:
peter
2011-06-17 13:47:09 +02:00
parent 40ce2b158c
commit f58be6c4d4
2 changed files with 7 additions and 2 deletions
@@ -335,6 +335,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
ApplicationManager.getApplication().assertIsDispatchThread();
if (isOutdated()) return;
boolean justShown = false;
if (!myLookup.isShown() && (!isAutopopupCompletion() || !myLookup.isCalculating())) {
if (hideAutopopupIfMeaningless()) {
return;
@@ -348,10 +349,14 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
}
myLookup.show();
justShown = true;
}
myLookup.refreshUi();
hideAutopopupIfMeaningless();
updateFocus();
if (justShown) {
myLookup.ensureSelectionVisible();
}
}
final boolean isInsideIdentifier() {
@@ -347,7 +347,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
myStartCompletionWhenNothingMatches = startCompletionWhenNothingMatches;
}
private void ensureSelectionVisible() {
public void ensureSelectionVisible() {
ListScrollingUtil.ensureIndexIsVisible(myList, myList.getSelectedIndex(), 1);
}
@@ -493,7 +493,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
if (choosePreselectedItem) {
myList.setSelectedValue(myPreselectedItem, false);
} else {
ListScrollingUtil.selectItem(myList, doSelectMostPreferableItem(getItems(), groups));
myList.setSelectedIndex(doSelectMostPreferableItem(getItems(), groups));
}
if (myPreselectedItem != null && myShown) {