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

Fixed some indenting issues, added indenting test

This commit is contained in:
Brian Fiete 2019-10-04 10:36:53 -07:00
parent df4573dca1
commit e5de09488e
7 changed files with 213 additions and 14 deletions

View file

@ -828,6 +828,7 @@ namespace IDE.ui
int ifDepth = 0;
bool isDoingCtl = false;
bool justFinishedCtlCond = false;
bool justFinishedCtl = false;
int ctlDepth = 0; // for, while, using
int extraTab = 1;
@ -906,20 +907,25 @@ namespace IDE.ui
{
if (blockDepth == 0)
{
if (((justFinishedIf) || (justFinishedCtl)) && (keywordStr != "else"))
{
// This catches the case of:
// if (a) Thing();
// if (b) ...
ifDepth = 0;
justFinishedIf = false;
ifCtlDepthStack.Clear();
ctlDepth = 0;
isDoingCtl = false;
}
justFinishedCtl = false;
justFinishedIf = false;
switch (keywordStr)
{
case "if":
if (justFinishedIf)
{
// This catches the case of:
// if (a) Thing();
// if (b) ...
ifDepth = 0;
justFinishedIf = false;
ifCtlDepthStack.Clear();
ctlDepth = 0;
}
if (isDoingCtl)
{
ctlDepth++;
@ -947,7 +953,11 @@ namespace IDE.ui
caseStartPos = checkIdx - 4;
inCaseExpr = true;
}
case "switch":
ifDepth = 0;
}
doingElse = keywordStr == "else";
}
keywordStr.Clear();
@ -1052,6 +1062,9 @@ namespace IDE.ui
startedWithType = false;
checkedStartedWithType = false;
if (isDoingCtl)
justFinishedCtl = true;
if (ifDepth == 0)
{
isDoingCtl = false;
@ -1075,7 +1088,6 @@ namespace IDE.ui
doingElse = false;
}
if (justFinishedIf)
{
// We had a non-else statement
@ -1092,7 +1104,6 @@ namespace IDE.ui
if (ifDepth > 0)
justFinishedIf = true;
//NEW
inCaseExpr = false;
inCaseExprNext = false;
inCaseExprNextLine = false;
@ -1147,6 +1158,7 @@ namespace IDE.ui
}
if ((ctlDepth > 0) && ((!justFinishedIf) || (insertingElseStmt)))
extraTab += ctlDepth;