mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make sure 'normal' token order is always LTR (even if default bidi text direction is set to RTL)
This commit is contained in:
@@ -162,6 +162,10 @@ abstract class LineLayout {
|
||||
}
|
||||
|
||||
private static void addRuns(List<BidiRun> runs, char[] text, int start, int end, int flags) {
|
||||
if (!Bidi.requiresBidi(text, start, end)) {
|
||||
addOrMergeRun(runs, new BidiRun((byte)0, start, end));
|
||||
return;
|
||||
}
|
||||
int afterLastTabPosition = start;
|
||||
for (int i = start; i < end; i++) {
|
||||
if (text[i] == '\t') {
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.VisualPosition;
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.openapi.editor.ex.BidiTextDirection;
|
||||
import com.intellij.testFramework.TestFileType;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -579,6 +581,19 @@ public class EditorRtlTest extends AbstractEditorTest {
|
||||
checkResult("<caret>RR");
|
||||
assertTrue(myEditor.getCaretModel().getPrimaryCaret().isAtBidiRunBoundary());
|
||||
}
|
||||
|
||||
public void testTokenOrderIsAlwaysLtr() throws Exception {
|
||||
BidiTextDirection savedValue = EditorSettingsExternalizable.getInstance().getBidiTextDirection();
|
||||
try {
|
||||
EditorSettingsExternalizable.getInstance().setBidiTextDirection(BidiTextDirection.RTL);
|
||||
prepare("<a>R</a>", TestFileType.XML);
|
||||
right();
|
||||
checkResult("<<caret>a>R</a>");
|
||||
}
|
||||
finally {
|
||||
EditorSettingsExternalizable.getInstance().setBidiTextDirection(savedValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareText(String text) throws IOException {
|
||||
prepare(text, TestFileType.TEXT);
|
||||
|
||||
Reference in New Issue
Block a user