From 13fe87def8218c57cd0e1bec4b3ba9761b9b3790 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Thu, 28 May 2015 17:33:53 +0300 Subject: [PATCH] remember editor.disable.rtl flag value at editor creation --- .../src/com/intellij/openapi/editor/impl/EditorImpl.java | 2 +- .../intellij/openapi/editor/impl/view/LineLayout.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index d32326e4333b..d3d63440f01e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -304,7 +304,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi private CaretImpl myPrimaryCaret; - private final boolean myDisableRtl = Registry.is("editor.disable.rtl"); + public final boolean myDisableRtl = Registry.is("editor.disable.rtl"); public final boolean myUseNewRendering = Registry.is("editor.new.rendering"); final EditorView myView; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java index 916b7f05d4d6..9f55f2e82e18 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java @@ -18,7 +18,6 @@ package com.intellij.openapi.editor.impl.view; import com.intellij.openapi.editor.colors.FontPreferences; import com.intellij.openapi.editor.impl.ComplementaryFontsRegistry; import com.intellij.openapi.editor.impl.EditorImpl; -import com.intellij.openapi.util.registry.Registry; import com.intellij.util.text.CharArrayUtil; import org.intellij.lang.annotations.JdkConstants; import org.jetbrains.annotations.NotNull; @@ -81,7 +80,7 @@ class LineLayout { EditorImpl editor = view.getEditor(); FontPreferences fontPreferences = editor.getColorsScheme().getFontPreferences(); char[] chars = CharArrayUtil.fromSequence(editor.getDocument().getImmutableCharSequence(), lineStartOffset, lineEndOffset); - List runs = createRuns(chars); + List runs = createRuns(editor, chars); for (BidiRun run : runs) { IterationState it = new IterationState(editor, lineStartOffset + run.startOffset, lineStartOffset + run.endOffset, false, false, false, false); @@ -101,7 +100,7 @@ class LineLayout { EditorImpl editor = view.getEditor(); FontPreferences fontPreferences = editor.getColorsScheme().getFontPreferences(); char[] chars = CharArrayUtil.fromSequence(text); - List runs = createRuns(chars); + List runs = createRuns(editor, chars); for (BidiRun run : runs) { addFragments(run, chars, run.startOffset, run.endOffset, fontStyle, fontPreferences, fontRenderContext, null); assert !run.fragments.isEmpty(); @@ -109,8 +108,8 @@ class LineLayout { return runs; } - private static List createRuns(char[] text) { - if (Registry.is("editor.disable.rtl")) return Collections.singletonList(new BidiRun((byte)0, 0, text.length)); + private static List createRuns(EditorImpl editor, char[] text) { + if (editor.myDisableRtl) return Collections.singletonList(new BidiRun((byte)0, 0, text.length)); Bidi bidi = new Bidi(text, 0, null, 0, text.length, Bidi.DIRECTION_LEFT_TO_RIGHT); int runCount = bidi.getRunCount(); List runs = new ArrayList(runCount);