mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-158439 Newline in FoldingBuilder.getPlaceholderText is displayed differently cross-platform
This commit is contained in:
+3
-2
@@ -344,8 +344,9 @@ public class SoftWrapApplianceManager implements Dumpable {
|
||||
String placeholder = foldRegion.getPlaceholderText();
|
||||
int placeholderWidthInPixels = 0;
|
||||
for (int i = 0; i < placeholder.length(); i++) {
|
||||
placeholderWidthInPixels += SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
|
||||
.charWidth(placeholder.charAt(i), myContext.fontType);
|
||||
char c = placeholder.charAt(i);
|
||||
if (myEditor.myUseNewRendering && c == '\n') c = ' '; // we display \n as space (see com.intellij.openapi.editor.impl.view.EditorView.getFoldRegionLayout)
|
||||
placeholderWidthInPixels += SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).charWidth(c, myContext.fontType);
|
||||
}
|
||||
|
||||
if (myContext.delayedSoftWrap == null) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.editor.impl.TextDrawingCallback;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
@@ -472,7 +473,7 @@ public class EditorView implements TextDrawingCallback, Disposable, Dumpable {
|
||||
LineLayout layout = foldRegion.getUserData(FOLD_REGION_TEXT_LAYOUT);
|
||||
if (layout == null) {
|
||||
TextAttributes placeholderAttributes = myEditor.getFoldingModel().getPlaceholderAttributes();
|
||||
layout = LineLayout.create(this, foldRegion.getPlaceholderText(),
|
||||
layout = LineLayout.create(this, StringUtil.replace(foldRegion.getPlaceholderText(), "\n", " "),
|
||||
placeholderAttributes == null ? Font.PLAIN : placeholderAttributes.getFontType());
|
||||
foldRegion.putUserData(FOLD_REGION_TEXT_LAYOUT, layout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user