ITypedRegion partition = bhscanner.getPartition(lineStart);
if(partitionIsIgnoredForLineIndentString(editOffset, partition)) {
if(line == 0) {
// empty/zero block balance
return new LineIndentResult("", "", new BlockBalanceResult());
} else {
return determineIndent(doc, bhscanner, line-1);
}
}
BlockBalanceResult blockInfo = bhscanner.calculateBlockBalances(lineStart, editOffset);
if(blockInfo.unbalancedOpens == 0 && blockInfo.unbalancedCloses > 0) {
int blockStartOffset = bhscanner.findBlockStart(blockInfo.rightmostUnbalancedBlockCloseOffset);
int blockStartLine = doc.getLineOfOffset(blockStartOffset);
IRegion blockStartLineInfo = doc.getLineInformationOfOffset(blockStartOffset);
assertTrue(blockStartLine < doc.getLineOfOffset(lineStart));
String startLineIndent = getLineIndent(doc, blockStartLineInfo);
// Now calculate the balance for the block start line, before the block start
int lineOffset = blockStartLineInfo.getOffset();
BlockBalanceResult blockStartInfo = bhscanner.calculateBlockBalances(lineOffset, blockStartOffset);
// Add the indent of the start line, plus the unbalanced opens there
String newLineIndent = addIndent(startLineIndent, blockStartInfo.unbalancedOpens);
return new LineIndentResult(null, newLineIndent, blockInfo);
}