mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-176213 Indents are moved to the right side of text in RTL languages
This commit is contained in:
@@ -150,15 +150,18 @@ abstract class LineLayout {
|
||||
List<BidiRun> runs = new ArrayList<>();
|
||||
int flags = view.getBidiFlags();
|
||||
if (startOffsetInEditor >= 0) {
|
||||
// running bidi algorithm separately for text fragments corresponding to different lexer tokens
|
||||
// skipping indent
|
||||
int relLastOffset = 0;
|
||||
while (relLastOffset < text.length && text[relLastOffset] == ' ' || text[relLastOffset] == '\t') relLastOffset++;
|
||||
addRuns(runs, text, 0, relLastOffset, flags);
|
||||
// running bidi algorithm separately for text fragments corresponding to different lexer tokens
|
||||
IElementType lastToken = null;
|
||||
HighlighterIterator iterator = view.getEditor().getHighlighter().createIterator(startOffsetInEditor);
|
||||
HighlighterIterator iterator = view.getEditor().getHighlighter().createIterator(startOffsetInEditor + relLastOffset);
|
||||
while (!iterator.atEnd() && iterator.getStart() - startOffsetInEditor < textLength) {
|
||||
int iteratorRelStart = alignToCodePointBoundary(text, iterator.getStart() - startOffsetInEditor);
|
||||
int iteratorRelEnd = alignToCodePointBoundary(text, iterator.getEnd() - startOffsetInEditor);
|
||||
IElementType currentToken = iterator.getTokenType();
|
||||
int relStartOffset = Math.max(0, iteratorRelStart);
|
||||
int relStartOffset = Math.max(relLastOffset, iteratorRelStart);
|
||||
String lcPrefix = getLineCommentPrefix(currentToken);
|
||||
// for line comments we process prefix and following text separately
|
||||
if (!StringUtil.isEmpty(lcPrefix) && lcPrefix.length() <= iteratorRelEnd - iteratorRelStart &&
|
||||
|
||||
@@ -590,4 +590,8 @@ public class EditorRtlTest extends AbstractRtlTest {
|
||||
right();
|
||||
checkResult("/<caret>/ R");
|
||||
}
|
||||
|
||||
public void testIndentIsTreatedSeparately() throws Exception {
|
||||
checkBidiRunBoundaries(" |R", "txt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user