mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-56893 Right line in editor not rendered properly after unfolding.
1. Added gutter sizes invalidation after fold region expansion via click on placeholder; 2. Modified IJ modules configuration in order to locate 'boot' module before jdk classes at classpath. That makes debugger navigate to correct source of the class that belongs to 'boot' module and replaces standard JDK class (standard IJ configurations add 'boot' module's content to boot class path);
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
@@ -19,7 +20,6 @@
|
||||
<orderEntry type="module" module-name="jsp-openapi" />
|
||||
<orderEntry type="module" module-name="jsp-spi" />
|
||||
<orderEntry type="module" module-name="execution-openapi" />
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="library" name="asm" level="project" />
|
||||
<orderEntry type="module" module-name="dom-openapi" />
|
||||
<orderEntry type="module" module-name="dom-impl" />
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="lang-api" exported="" />
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="module" module-name="vcs-api" />
|
||||
<orderEntry type="library" name="OroMatcher" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
|
||||
@@ -3103,6 +3103,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
region.setExpanded(true);
|
||||
}
|
||||
});
|
||||
|
||||
// The call below is performed because gutter's height is not updated sometimes, i.e. it sticks to the value that corresponds
|
||||
// to the situation when fold region is collapsed. That causes bottom of the gutter to not be repainted and that looks really ugly.
|
||||
getGutterComponentEx().invalidate();
|
||||
}
|
||||
|
||||
if (myMousePressedEvent != null && myMousePressedEvent.getClickCount() == 1 && myMousePressedInsideSelection) {
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
|
||||
int sortingKey = provider.getSortingKey();
|
||||
|
||||
// There is a possible case that, say, fold region is soft wrapped. We don't want to perform unnecessary then.
|
||||
if (context.offset < sortingKey) {
|
||||
if (context.offset <= sortingKey) {
|
||||
result = strategy.advance(context, sortingKey);
|
||||
if (result != null) {
|
||||
return result;
|
||||
|
||||
+2
@@ -249,6 +249,8 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
start = context.offset;
|
||||
softWrapStartOffset = currentFold.getEndOffset();
|
||||
}
|
||||
myOffset2fontType.clear();
|
||||
myOffset2widthInPixels.clear();
|
||||
}
|
||||
|
||||
end = iterationState.getEndOffset();
|
||||
|
||||
+58
-1
@@ -15,11 +15,17 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.impl.softwrap.mapping;
|
||||
|
||||
import com.intellij.openapi.editor.FoldRegion;
|
||||
import com.intellij.openapi.editor.FoldingModel;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.VisualPosition;
|
||||
import com.intellij.openapi.editor.ex.SoftWrapModelEx;
|
||||
import com.intellij.openapi.editor.impl.FoldRegionImpl;
|
||||
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
@@ -56,8 +62,59 @@ public class SoftWrapApplianceManagerTest extends LightPlatformCodeInsightTestCa
|
||||
assertNotNull(getSoftWrapModel().getSoftWrap(offset));
|
||||
}
|
||||
|
||||
public void testFoldRegionCollapsing() throws Exception {
|
||||
String text =
|
||||
"class Test {\n" +
|
||||
" public void foo() {\n" +
|
||||
" System.out.println(\"test\");\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
init(300, text);
|
||||
final FoldingModel foldingModel = myEditor.getFoldingModel();
|
||||
assertEmpty(foldingModel.getAllFoldRegions());
|
||||
|
||||
final int startOffset = text.indexOf('{');
|
||||
final int endOffset = text.indexOf('}') + 1;
|
||||
|
||||
VisualPosition foldStartPosition = myEditor.offsetToVisualPosition(startOffset);
|
||||
|
||||
foldingModel.runBatchFoldingOperation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
foldingModel.addFoldRegion(startOffset, endOffset, "...");
|
||||
}
|
||||
});
|
||||
|
||||
final FoldRegion foldRegion = foldingModel.getAllFoldRegions()[0];
|
||||
assertNotNull(foldRegion);
|
||||
assertTrue(foldRegion.isExpanded());
|
||||
foldingModel.runBatchFoldingOperation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
foldRegion.setExpanded(false);
|
||||
}
|
||||
});
|
||||
|
||||
// Expecting that all offsets that belong to collapsed fold region point to the region's start.
|
||||
assertEquals(foldStartPosition, myEditor.offsetToVisualPosition(startOffset + 5));
|
||||
}
|
||||
|
||||
private void init(final int visibleWidth) throws Exception {
|
||||
configureByFile(PATH + getTestName(false) + ".txt");
|
||||
configureByFile(PATH + getFileName());
|
||||
initCommon(visibleWidth);
|
||||
}
|
||||
|
||||
private void init(int visibleWidth, String fileText) throws IOException {
|
||||
configureFromFileText(getFileName(), fileText);
|
||||
initCommon(visibleWidth);
|
||||
}
|
||||
|
||||
private String getFileName() {
|
||||
return getTestName(false) + ".txt";
|
||||
}
|
||||
|
||||
private static void initCommon(final int visibleWidth) {
|
||||
myEditor.getSettings().setUseSoftWraps(true);
|
||||
SoftWrapModelImpl model = (SoftWrapModelImpl)myEditor.getSoftWrapModel();
|
||||
model.refreshSettings();
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="lang-api" />
|
||||
<orderEntry type="module" module-name="platform-api" />
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
<orderEntry type="module" module-name="platform-impl" />
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="module" module-name="annotations" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
|
||||
Reference in New Issue
Block a user