Fixes to Lua Writer on behalf of Rolanmen

This commit is contained in:
adelikat 2012-07-23 12:28:03 +00:00
parent 8b06a39ef9
commit 8825cb7499
1 changed files with 14 additions and 4 deletions

View File

@ -15,6 +15,7 @@ namespace BizHawk.MultiClient
public partial class LuaWriter : Form
{
//TODO:
//make functions is string part of string or comment since the actual way of validating it isn't correct
//fix tabs (tab should be 4 characters)
//Line numbers
//Option to toggle line numbers
@ -228,14 +229,23 @@ namespace BizHawk.MultiClient
{
foreach (Match libraryWordMatch in libraryWords.Matches(LuaText.Text))
{
if (libraryWordMatch.Index > 0)
if (libraryWordMatch.Index >= 0)
{
if (!IsAlphaNumeric(LuaText.Text[libraryWordMatch.Index - 1]))
char before = ' ', after = ' ';
if (libraryWordMatch.Index > 0)
before = LuaText.Text[libraryWordMatch.Index - 1];
if (libraryWordMatch.Index + libraryWordMatch.Length != LuaText.Text.Length)
after = LuaText.Text[libraryWordMatch.Index + libraryWordMatch.Length];
if (!IsAlphaNumeric(before))
{
if (LuaText.Text[libraryWordMatch.Index + libraryWordMatch.Length] == '.')
if (after == '.')
{
LuaText.Select(libraryWordMatch.Index, libraryWordMatch.Length);
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaLibraryColor);
if(LuaText.SelectionColor.ToArgb() != Global.Config.LuaCommentColor && LuaText.SelectionColor.ToArgb() != Global.Config.LuaStringColor)
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaLibraryColor);
}
}
}