From a831a7cd1230fe8b9742ff1182a6132688a286d0 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 21 Feb 2011 12:40:25 +0100 Subject: [PATCH] [rev=yole] revert up/down arrows in non-focused lookups to the old behavior --- .../codeInsight/completion/JavaAutoPopupTest.groovy | 6 +++--- .../codeInsight/lookup/impl/LookupActionHandler.java | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy index 1439b3b55f83..64ed0eedb9e9 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy @@ -429,9 +429,9 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { public void testVerticalArrows() { testArrows false, false, 0, -1 - testArrows false, true, -1, 1 - testArrows true, false, 0, -1 - testArrows true, true, -1, 1 + testArrows false, true, 0, -1 + testArrows true, false, 0, 1 + testArrows true, true, 0, 1 } public void testHideOnOnePrefixVariant() { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java index de8e1eb23ab0..b00d961853ef 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java @@ -17,6 +17,7 @@ package com.intellij.codeInsight.lookup.impl; import com.intellij.codeInsight.lookup.LookupManager; +import com.intellij.ide.ui.UISettings; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; @@ -73,11 +74,6 @@ public abstract class LookupActionHandler extends EditorActionHandler { protected void executeInLookup(final LookupImpl lookup, DataContext context) { if (!lookup.isFocused()) { - if (lookup.isPositionedAboveCaret()) { - myOriginalHandler.execute(lookup.getEditor(), context); - return; - } - lookup.setFocused(true); lookup.getList().setSelectedIndex(0); lookup.refreshUi(); @@ -94,16 +90,14 @@ public abstract class LookupActionHandler extends EditorActionHandler { protected void executeInLookup(final LookupImpl lookup, DataContext context) { if (!lookup.isFocused()) { - if (!lookup.isPositionedAboveCaret()) { + if (!UISettings.getInstance().CYCLE_SCROLLING) { myOriginalHandler.execute(lookup.getEditor(), context); return; } lookup.setFocused(true); - final int index = ApplicationManager.getApplication().isUnitTestMode() ? lookup.getItems().size() - 1 : lookup.getList().getLastVisibleIndex(); - lookup.getList().setSelectedIndex(index); + lookup.getList().setSelectedIndex(0); lookup.refreshUi(); - return; } ListScrollingUtil.moveUp(lookup.getList(), 0); }