From 1ed749bf85c17ba135bd4a57f11b4d14e071a1d5 Mon Sep 17 00:00:00 2001 From: niel-archer Date: Sat, 17 Dec 2011 12:15:38 +0000 Subject: [PATCH] Bug 2995296 fix --- trunk/Editor/SyntaxRichTextBox.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/trunk/Editor/SyntaxRichTextBox.cs b/trunk/Editor/SyntaxRichTextBox.cs index ddb55d9..61e622f 100644 --- a/trunk/Editor/SyntaxRichTextBox.cs +++ b/trunk/Editor/SyntaxRichTextBox.cs @@ -1748,14 +1748,18 @@ namespace LSLEditor string strW = GetNewWhiteSpace(-1); int intTabs = (int)(strW.Length / AutoFormatter.GetTab().Length); - if (this.SelectionLength == 0) + int intLastLine = this.GetLineFromCharIndex(this.SelectionStart + this.SelectionLength); + + int intLine = this.GetLineFromCharIndex(this.SelectionStart); + this.SelectionStart = this.GetFirstCharIndexFromLine(intLine); + int intLength = 0; + do { - int intLine = this.GetLineFromCharIndex(this.SelectionStart); - int intStart = this.GetFirstCharIndexFromLine(intLine); - int intLength = this.Lines[intLine].Length + 1; - this.SelectionStart = intStart; - this.SelectionLength = intLength; - } + intLength += this.Lines[intLine].Length + 1; + intLine++; + } while (intLine <= intLastLine); + this.SelectionLength = intLength; + string strSelectedText = AutoFormatter.MultiLineComment(blnAdd, intTabs, this.SelectedText); int intBackup = this.SelectionStart;