private void LuaAutoIndentNeeded(object sender, AutoIndentEventArgs args)
{
//end of block
if (Regex.IsMatch(args.LineText, @"^\s*(end|until)\b"))
{
args.Shift = -args.TabLength;
args.ShiftNextLines = -args.TabLength;
return;
}
// then ...
if (Regex.IsMatch(args.LineText, @"\b(then)\s*\S+"))
return;
//start of operator block
if (Regex.IsMatch(args.LineText, @"^\s*(function|do|for|while|repeat|if)\b"))
{
args.ShiftNextLines = args.TabLength;
return;
}
//Statements else, elseif, case etc
if (Regex.IsMatch(args.LineText, @"^\s*(else|elseif)\b", RegexOptions.IgnoreCase))
{
args.Shift = -args.TabLength;
}
}