mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed formatting of multi-line string that doesn't start on a new line
This commit is contained in:
parent
60fdfff8d7
commit
abf58fe89f
1 changed files with 13 additions and 1 deletions
|
@ -1337,6 +1337,8 @@ void BfPrinter::Visit(BfLiteralExpression* literalExpr)
|
|||
{
|
||||
int srcLineStart = 0;
|
||||
|
||||
bool startsOnEmptyLine = true;
|
||||
|
||||
int checkIdx = literalExpr->GetSrcStart() - 1;
|
||||
while (checkIdx >= 0)
|
||||
{
|
||||
|
@ -1346,12 +1348,19 @@ void BfPrinter::Visit(BfLiteralExpression* literalExpr)
|
|||
srcLineStart = checkIdx + 1;
|
||||
break;
|
||||
}
|
||||
if ((c != '\t') && (c != ' '))
|
||||
startsOnEmptyLine = false;
|
||||
checkIdx--;
|
||||
}
|
||||
|
||||
int queuedSpaceCount = mQueuedSpaceCount;
|
||||
FlushIndent();
|
||||
|
||||
if (!startsOnEmptyLine)
|
||||
{
|
||||
queuedSpaceCount = mCurIndentLevel * mTabSize;
|
||||
}
|
||||
|
||||
for (int i = literalExpr->GetSrcStart(); i < (int)literalExpr->GetSrcEnd(); i++)
|
||||
{
|
||||
char c = sourceData->mSrc[i];
|
||||
|
@ -1379,6 +1388,9 @@ void BfPrinter::Visit(BfLiteralExpression* literalExpr)
|
|||
}
|
||||
}
|
||||
|
||||
// if (!startsOnEmptyLine)
|
||||
// mCurIndentLevel--;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue