1
0
Fork 0
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:
Brian Fiete 2025-02-03 10:38:46 -08:00
parent 60fdfff8d7
commit abf58fe89f

View file

@ -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;
}
}