From 2fc36dca9bf5fc6ba79fe250e38d07676e2a1c26 Mon Sep 17 00:00:00 2001 From: jxq2000 Date: Wed, 8 Aug 2012 21:33:24 +0000 Subject: [PATCH] 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. --- BizHawk.MultiClient/tools/LuaWriter.cs | 58 +++++++------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/BizHawk.MultiClient/tools/LuaWriter.cs b/BizHawk.MultiClient/tools/LuaWriter.cs index aa629dd4b1..f8e3b54495 100644 --- a/BizHawk.MultiClient/tools/LuaWriter.cs +++ b/BizHawk.MultiClient/tools/LuaWriter.cs @@ -68,59 +68,33 @@ namespace BizHawk.MultiClient return; } - ProcessText(LuaText.GetLineFromCharIndex(LuaText.SelectionStart)); + ProcessText(); hasChanged = false; } - /// - /// ProcessText - Adds color and formatting to the text depending on the formatting settings selected - /// - /// 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). - 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; }