LuaWriter. Now colors Multi-Line Comments.
This commit is contained in:
parent
b2323458ba
commit
6f295fe0c8
|
@ -39,14 +39,27 @@ namespace BizHawk.MultiClient
|
||||||
foreach (Match CommentMatch in new Regex("--").Matches(LuaText.Text))
|
foreach (Match CommentMatch in new Regex("--").Matches(LuaText.Text))
|
||||||
{
|
{
|
||||||
int endComment;
|
int endComment;
|
||||||
|
|
||||||
if (LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1 == LuaText.Lines.Count())
|
if (LuaText.Text.Substring(CommentMatch.Index, 4) == "--[[")
|
||||||
endComment = LuaText.Text.Length - CommentMatch.Index;
|
{
|
||||||
|
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
|
else
|
||||||
endComment = LuaText.GetFirstCharIndexFromLine(LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1) - CommentMatch.Index;
|
{
|
||||||
|
if (LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1 == LuaText.Lines.Count())
|
||||||
LuaText.Select(CommentMatch.Index, endComment);
|
endComment = LuaText.Text.Length - CommentMatch.Index;
|
||||||
LuaText.SelectionColor = Color.Green;
|
else
|
||||||
|
endComment = LuaText.GetFirstCharIndexFromLine(LuaText.GetLineFromCharIndex(CommentMatch.Index) + 1) - CommentMatch.Index;
|
||||||
|
|
||||||
|
LuaText.Select(CommentMatch.Index, endComment);
|
||||||
|
LuaText.SelectionColor = Color.Green;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaText.Select(selPos, selChars);
|
LuaText.Select(selPos, selChars);
|
||||||
|
|
Loading…
Reference in New Issue