mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
JavaTextBlockIndentPass: take last line indent chars into consideration(IDEA-225003)
GitOrigin-RevId: d7f7d7ad34a36b7c1f4062f7a50367b284317ee3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3e391e0006
commit
af895ef068
+9
-3
@@ -225,9 +225,11 @@ public class JavaTextBlockIndentPass extends TextEditorHighlightingPass {
|
||||
@Nullable
|
||||
private static IndentType findIndentType(@NotNull String[] lines, int indent) {
|
||||
IndentType indentType = null;
|
||||
for (String line : lines) {
|
||||
for (int i = 0; i < indent; i++) {
|
||||
char c = line.charAt(i);
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
String line = lines[i];
|
||||
if (!isContentPart(lines, i, line)) continue;
|
||||
for (int j = 0; j < indent; j++) {
|
||||
char c = line.charAt(j);
|
||||
IndentType currentType = IndentType.of(c);
|
||||
if (currentType == null) return null;
|
||||
if (indentType == null) {
|
||||
@@ -241,6 +243,10 @@ public class JavaTextBlockIndentPass extends TextEditorHighlightingPass {
|
||||
return indentType;
|
||||
}
|
||||
|
||||
private static boolean isContentPart(@NotNull String[] lines, int i, String line) {
|
||||
return !line.isEmpty() && (i == lines.length - 1 || !line.chars().allMatch(Character::isWhitespace));
|
||||
}
|
||||
|
||||
private enum IndentType {
|
||||
SPACES,
|
||||
TABS;
|
||||
|
||||
Reference in New Issue
Block a user