Revert previous commit related to updating colors/format of only one line at a time since that won't catch multi-line strings or comments.

This commit is contained in:
jxq2000 2012-08-08 21:33:24 +00:00
parent 9979c9f0d5
commit 2fc36dca9b
1 changed files with 16 additions and 42 deletions

View File

@ -68,59 +68,33 @@ namespace BizHawk.MultiClient
return;
}
ProcessText(LuaText.GetLineFromCharIndex(LuaText.SelectionStart));
ProcessText();
hasChanged = false;
}
/// <summary>
/// ProcessText - Adds color and formatting to the text depending on the formatting settings selected
/// </summary>
/// <param name="rowChanged">This indicates the row that needs updating. Likely will need upates later
/// to support multiple rows at once (e.g. when pasting multiple lines).
/// For now, default value is 0, which will keep behavior as it was (update all lines).</param>
private void ProcessText(int rowChanged = 0)
private void ProcessText()
{
ProcessingText = true;
int selPos = LuaText.SelectionStart;
int selChars = LuaText.SelectedText.Length;
if (rowChanged == 0) //Deafult case, change all lines
{
LuaText.SelectAll();
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaDefaultTextColor);
if (Global.Config.LuaDefaultTextBold)
LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold);
else
LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Regular);
LuaText.SelectAll();
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaDefaultTextColor);
if (Global.Config.LuaDefaultTextBold)
LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold);
else
LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Regular);
AddKeyWords();
AddLibraries();
AddSymbols();
AddComments();
AddStrings();
AddLongStrings();
ColorText();
}
else //Specific line was passed in to change, only update that line
{
LuaText.Select(LuaText.GetFirstCharIndexFromLine(rowChanged),LuaText.GetFirstCharIndexFromLine(rowChanged + 1) - 1);
//Currently just calls the same tags - they will need to be updated to only look to the appropriate row.
AddKeyWords();
AddLibraries();
AddSymbols();
AddComments();
AddStrings();
AddLongStrings();
ColorText();
}
AddKeyWords();
AddLibraries();
AddSymbols();
AddComments();
AddStrings();
AddLongStrings();
ColorText();
LuaText.Select(selPos, selChars);
ProcessingText = false;
}