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 78138c956ef0..021963c1599b 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 @@ -150,7 +150,7 @@ class LineLayout { private static void addRuns(List runs, char[] text, int start, int end) { if (start >= end) return; - Bidi bidi = new Bidi(text, start, null, 0, end - start, Bidi.DIRECTION_LEFT_TO_RIGHT); + Bidi bidi = new Bidi(text, start, null, 0, end - start, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); int runCount = bidi.getRunCount(); for (int i = 0; i < runCount; i++) { addOrMergeRun(runs, new BidiRun((byte)bidi.getRunLevel(i), start + bidi.getRunStart(i), start + bidi.getRunLimit(i))); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java index bbe2de51f912..d55f36c1e9a6 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java @@ -40,8 +40,12 @@ public class EditorRtlTest extends AbstractEditorTest { @Override protected void tearDown() throws Exception { - super.tearDown(); - Registry.get("editor.new.rendering").setValue(false); + try { + Registry.get("editor.new.rendering").setValue(false); + } + finally { + super.tearDown(); + } } public void testPositionCalculations() throws IOException { @@ -499,12 +503,12 @@ public class EditorRtlTest extends AbstractEditorTest { } public void testJavadocTokensAreMergedForBidiLayoutPurposes() throws Exception { - prepare("/** R R */ class Foo {}", TestFileType.JAVA); - for (int i = 0; i < 5; i++) { + prepare("/**R R*/ class Foo {}", TestFileType.JAVA); + for (int i = 0; i < 4; i++) { right(); } - checkResult("/** R R */ class Foo {}"); + checkResult("/**R R*/ class Foo {}"); } public void testXmlTextIsLaidOutCorrectly() throws Exception { @@ -553,6 +557,12 @@ public class EditorRtlTest extends AbstractEditorTest { assertVisualCaretLocation(1, 3, true); } + public void testLineGeneralDirectionAutodetection() throws Exception { + prepareText("RLR"); + right(); + checkResult("RLR"); + } + private void prepareText(String text) throws IOException { prepare(text, TestFileType.TEXT); }