mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-68429 - NPE: EditorView.getFoldRegionLayout
allow null folding placeholder attributes in new editor rendering code
This commit is contained in:
@@ -37,6 +37,7 @@ import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.TFloatArrayList;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -283,7 +284,8 @@ class EditorPainter {
|
||||
}
|
||||
}
|
||||
|
||||
float paintLineLayoutWithEffect(Graphics2D g, LineLayout layout, float x, float y, Color effectColor, EffectType effectType) {
|
||||
float paintLineLayoutWithEffect(Graphics2D g, LineLayout layout, float x, float y,
|
||||
@Nullable Color effectColor, @Nullable EffectType effectType) {
|
||||
float initialX = x;
|
||||
for (LineLayout.VisualFragment fragment : layout.getFragmentsInVisualOrder(x)) {
|
||||
fragment.draw(g, x, y);
|
||||
|
||||
@@ -299,7 +299,9 @@ public class EditorView implements Disposable {
|
||||
LineLayout getFoldRegionLayout(FoldRegion foldRegion) {
|
||||
LineLayout layout = foldRegion.getUserData(FOLD_REGION_TEXT_LAYOUT);
|
||||
if (layout == null) {
|
||||
layout = new LineLayout(this, foldRegion.getPlaceholderText(), myEditor.getFoldingModel().getPlaceholderAttributes().getFontType(),
|
||||
TextAttributes placeholderAttributes = myEditor.getFoldingModel().getPlaceholderAttributes();
|
||||
layout = new LineLayout(this, foldRegion.getPlaceholderText(),
|
||||
placeholderAttributes == null ? Font.PLAIN : placeholderAttributes.getFontType(),
|
||||
myFontRenderContext);
|
||||
foldRegion.putUserData(FOLD_REGION_TEXT_LAYOUT, layout);
|
||||
}
|
||||
|
||||
+3
-1
@@ -271,7 +271,9 @@ class VisualLineFragmentsIterator implements Iterator<VisualLineFragmentsIterato
|
||||
if (myDelegate == null) {
|
||||
LineLayout foldRegionLayout = myView.getFoldRegionLayout(myFoldRegion);
|
||||
TextAttributes attributes = myView.getEditor().getFoldingModel().getPlaceholderAttributes();
|
||||
myView.getPainter().paintLineLayoutWithEffect(g, foldRegionLayout, x, y, attributes.getEffectColor(), attributes.getEffectType());
|
||||
myView.getPainter().paintLineLayoutWithEffect(g, foldRegionLayout, x, y,
|
||||
attributes == null ? null : attributes.getEffectColor(),
|
||||
attributes == null ? null : attributes.getEffectType());
|
||||
}
|
||||
else {
|
||||
int lineStartOffset = myDocument.getLineStartOffset(myCurrentStartLogicalLine);
|
||||
|
||||
Reference in New Issue
Block a user