Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladimir.Orlov
2016-07-11 15:44:43 +03:00
4 changed files with 21 additions and 5 deletions
+1 -1
View File
@@ -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)
@@ -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<VirtualFile> getAdditionalRootsToIndex();
@NotNull
private static Set<VirtualFile> filterOutNulls(@NotNull IndexableSetContributor contributor,
@@ -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;
@@ -412,4 +412,17 @@ public class EditorImplTest extends AbstractEditorTest {
mouse().pressAtLineNumbers(0).dragToLineNumbers(2).shift().release();
checkResultByText("<selection>abc\ndef\nghi</selection>");
}
public void testScrollingInEditorOfSmallHeight() throws Exception {
initText("abc\n<caret>");
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());
}
}