1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed indenting for op-assignment operator overloads

This commit is contained in:
Brian Fiete 2020-10-22 07:05:11 -07:00
parent 9b5324d343
commit 6e71cbc765

View file

@ -1904,6 +1904,7 @@ namespace IDE.ui
if (indentCount == column / 4)
{
bool isExpr = false;
bool mayBeExpr = false;
char8 prevC = 0;
int checkIdx = CursorTextPos - 1;
@ -1918,7 +1919,29 @@ namespace IDE.ui
continue;
}
prevC = mData.mText[checkIdx].mChar;
if (mayBeExpr)
{
if (prevC.IsWhiteSpace)
continue;
if ((prevC == '(') || (prevC == ')') || (prevC == '{') || (prevC == '}'))
{
mayBeExpr = false;
}
else if (prevC.IsLetterOrDigit)
{
if ((prevC == 'r') && (displayType == .Keyword))
{
// operator overload
mayBeExpr = false;
continue;
}
isExpr = true;
break;
}
}
if (prevC == ')')
{
parenOpenCount++;
@ -1940,8 +1963,8 @@ namespace IDE.ui
break;
if (prevC == '=')
{
isExpr = true;
break;
// Is expression if this isn't following the word 'operator'
mayBeExpr = true;
}
}