diff --git a/build/scripts/download_kotlin.gant b/build/scripts/download_kotlin.gant index 7bf7a630f300..a32ece984b5f 100644 --- a/build/scripts/download_kotlin.gant +++ b/build/scripts/download_kotlin.gant @@ -27,7 +27,7 @@ import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant") -String kotlinBuildConfigurationOnPublicTeamCity = "Kotlin_102_Idea145branch160versionNoTests" +String kotlinBuildConfigurationOnPublicTeamCity = "Kotlin_103_Idea145branch160versionNoTests" target('default': 'Ensures that build/kotlinc directory contains JARs from Kotlin plugin compatible with current IDEA sources. These JARs are used by build scripts.') { def communityHome = guessHome(this) diff --git a/platform/indexing-api/src/com/intellij/util/indexing/IndexableSetContributor.java b/platform/indexing-api/src/com/intellij/util/indexing/IndexableSetContributor.java index c971855d1a59..5858c2514c58 100644 --- a/platform/indexing-api/src/com/intellij/util/indexing/IndexableSetContributor.java +++ b/platform/indexing-api/src/com/intellij/util/indexing/IndexableSetContributor.java @@ -18,7 +18,6 @@ package com.intellij.util.indexing; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; @@ -60,7 +59,7 @@ public abstract class IndexableSetContributor { * the returned set should not contain nulls or invalid files */ @NotNull - public abstract Set getAdditionalRootsToIndex(); + public abstract Set getAdditionalRootsToIndex(); @NotNull private static Set filterOutNulls(@NotNull IndexableSetContributor contributor, diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java index 2c49a3e32fb6..5735ed6279b4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java @@ -227,8 +227,12 @@ public class ScrollingModelImpl implements ScrollingModelEx { // the following code tries to keeps 1 line above and 1 line below if available in viewRect int lineHeight = myEditor.getLineHeight(); - int scrollUpBy = viewRect.y - targetLocation.y + (viewRect.height > lineHeight ? lineHeight : 0); - int scrollDownBy = targetLocation.y - viewRect.y - Math.max(0, viewRect.height - 2 * lineHeight); + // to avoid 'hysteresis', minAcceptableY should be always less or equal to maxAcceptableY + int minAcceptableY = viewRect.y + Math.max(0, Math.min(lineHeight, viewRect.height - 3 * lineHeight)); + int maxAcceptableY = viewRect.y + (viewRect.height <= lineHeight ? 0 : + (viewRect.height - (viewRect.height <= 2 * lineHeight ? lineHeight : 2 * lineHeight))); + int scrollUpBy = minAcceptableY - targetLocation.y; + int scrollDownBy = targetLocation.y - maxAcceptableY; int centerPosition = targetLocation.y - viewRect.height / 3; int vOffset = viewRect.y; diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java index 18b06bc74e4b..6f80ee23c22a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java @@ -412,4 +412,17 @@ public class EditorImplTest extends AbstractEditorTest { mouse().pressAtLineNumbers(0).dragToLineNumbers(2).shift().release(); checkResultByText("abc\ndef\nghi"); } + + public void testScrollingInEditorOfSmallHeight() throws Exception { + initText("abc\n"); + int heightInPixels = (int)(myEditor.getLineHeight() * 1.5); + EditorTestUtil.setEditorVisibleSizeInPixels(myEditor, + 1000 * EditorUtil.getSpaceWidth(Font.PLAIN, myEditor), + heightInPixels); + myEditor.getSettings().setAnimatedScrolling(false); + type('a'); + assertEquals(heightInPixels - myEditor.getLineHeight(), myEditor.getScrollingModel().getVerticalScrollOffset()); + type('b'); + assertEquals(heightInPixels - myEditor.getLineHeight(), myEditor.getScrollingModel().getVerticalScrollOffset()); + } }