LuaWriter. Now colors Multi-Line Comments.

This commit is contained in:
rolanmen1 2012-07-20 05:36:33 +00:00
parent b2323458ba
commit 6f295fe0c8
1 changed files with 20 additions and 7 deletions

View File

@ -39,14 +39,27 @@ namespace BizHawk.MultiClient
foreach (Match CommentMatch in new Regex("--").Matches(LuaText.Text))
{
int endComment;
if (LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1 == LuaText.Lines.Count())
endComment = LuaText.Text.Length - CommentMatch.Index;
if (LuaText.Text.Substring(CommentMatch.Index, 4) == "--[[")
{
if (LuaText.Find("]]", RichTextBoxFinds.MatchCase) > 0)
endComment = LuaText.SelectionStart - CommentMatch.Index + 2;
else
endComment = LuaText.Text.Length;
LuaText.Select(CommentMatch.Index, endComment);
LuaText.SelectionColor = Color.Green;
}
else
endComment = LuaText.GetFirstCharIndexFromLine(LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1) - CommentMatch.Index;
LuaText.Select(CommentMatch.Index, endComment);
LuaText.SelectionColor = Color.Green;
{
if (LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1 == LuaText.Lines.Count())
endComment = LuaText.Text.Length - CommentMatch.Index;
else
endComment = LuaText.GetFirstCharIndexFromLine(LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1) - CommentMatch.Index;
LuaText.Select(CommentMatch.Index, endComment);
LuaText.SelectionColor = Color.Green;
}
}
LuaText.Select(selPos, selChars);