mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't always use LTR base direction for bidirectional text layout, autodetect direction as per Unicode standard
(following bug report at https://code.google.com/p/android/issues/detail?id=182739#c13)
This commit is contained in:
@@ -150,7 +150,7 @@ class LineLayout {
|
||||
|
||||
private static void addRuns(List<BidiRun> 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)));
|
||||
|
||||
+15
-5
@@ -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("<caret>/** R R */ class Foo {}", TestFileType.JAVA);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
prepare("<caret>/**R R*/ class Foo {}", TestFileType.JAVA);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
right();
|
||||
}
|
||||
|
||||
checkResult("/** R R<caret> */ class Foo {}");
|
||||
checkResult("/**R R<caret>*/ 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("<caret>RLR");
|
||||
right();
|
||||
checkResult("RLR<caret>");
|
||||
}
|
||||
|
||||
private void prepareText(String text) throws IOException {
|
||||
prepare(text, TestFileType.TEXT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user