LuaWriter. Color numbers, need to make it color hexadecimals aswell.

This commit is contained in:
rolanmen1 2012-08-12 07:06:38 +00:00
parent 6dfcd10575
commit e2469328ae
2 changed files with 26 additions and 0 deletions

View File

@ -566,6 +566,8 @@ namespace BizHawk.MultiClient
public bool LuaSymbolBold = false;
public int LuaLibraryColor = -16711681;
public bool LuaLibraryBold = false;
public int LuaDecimalColor = -23296;
public bool LuaDecimalBold = false;
public float LuaWriterFontSize = 11;
public string LuaWriterFont = "Courier New";
public float LuaWriterZoom = 1;

View File

@ -87,6 +87,7 @@ namespace BizHawk.MultiClient
LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Regular);
AddCommentsAndStrings();
AddNumbers();
AddKeyWords();
AddLibraries();
AddSymbols();
@ -99,6 +100,29 @@ namespace BizHawk.MultiClient
LuaText.Refresh();
}
private void AddNumbers()
{
string temp = LuaText.Text;
foreach (Match match in new Regex(@"(\d+\.?\d+|\.\d+|\d+)").Matches(temp))
{
if (!IsThisPartOfStringOrComment(match.Index))
{
char before = ' ', after = ' ';
if (match.Index > 0)
before = LuaText.Text[match.Index - 1];
if (match.Index + match.Length != LuaText.Text.Length)
after = LuaText.Text[match.Index + match.Length];
if (!char.IsLetter(before) && !char.IsLetter(after))
{
AddPosition(match.Index, match.Length, Global.Config.LuaDecimalColor, Global.Config.LuaDecimalBold, 0);
}
}
}
}
private void AddCommentsAndStrings()
{
string temp = LuaText.Text;