mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RUBY-18147 Fix encoding text to folded scalars-compatible text routine
This commit is contained in:
@@ -57,11 +57,16 @@ public class YAMLScalarTextImpl extends YAMLBlockScalarImpl implements YAMLScala
|
||||
final String indentString = StringUtil.repeatSymbol(' ', indent);
|
||||
|
||||
final List<Pair<TextRange, String>> result = new ArrayList<>();
|
||||
|
||||
int currentLength = 0;
|
||||
boolean currentLineIsIndented = input.length() > 0 && input.charAt(0) == ' ';
|
||||
for (int i = 0; i < input.length(); ++i) {
|
||||
if (input.charAt(i) == '\n') {
|
||||
final String replacement;
|
||||
if (i + 1 >= input.length() || YAMLGrammarCharUtil.isSpaceLike(input.charAt(i + 1))) {
|
||||
if (i + 1 >= input.length() ||
|
||||
YAMLGrammarCharUtil.isSpaceLike(input.charAt(i + 1)) ||
|
||||
input.charAt(i + 1) == '\n' ||
|
||||
currentLineIsIndented) {
|
||||
replacement = "\n" + indentString;
|
||||
}
|
||||
else {
|
||||
@@ -70,6 +75,7 @@ public class YAMLScalarTextImpl extends YAMLBlockScalarImpl implements YAMLScala
|
||||
|
||||
result.add(Pair.create(TextRange.from(i, 1), replacement));
|
||||
currentLength = 0;
|
||||
currentLineIsIndented = i + 1 < input.length() && input.charAt(i + 1) == ' ';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user