Browse Source

Fixed ArgumentOutOfRangeException in Boo forms designer and added workaround for another possible ArgumentOutOfRangeException (also when leaving the designer).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4888 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
7f2f49377d
  1. 5
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs
  2. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaControl.cs

5
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -502,6 +502,11 @@ namespace ICSharpCode.FormsDesigner @@ -502,6 +502,11 @@ namespace ICSharpCode.FormsDesigner
int line = GetEventHandlerInsertionLine(currentClassPart);
LoggingService.Debug("-> Inserting new event handler at line " + line.ToString(System.Globalization.CultureInfo.InvariantCulture));
if (line - 1 == this.viewContent.PrimaryFileDocument.TotalNumberOfLines) {
// insert a newline at the end of file if necessary (can happen in Boo if there is no newline at the end of the document)
this.viewContent.PrimaryFileDocument.Insert(this.viewContent.PrimaryFileDocument.TextLength, Environment.NewLine);
}
int offset = this.viewContent.PrimaryFileDocument.GetLineSegment(line - 1).Offset;
this.viewContent.PrimaryFileDocument.Insert(offset, CreateEventHandler(edesc.EventType, eventMethodName, body, tabs));

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaControl.cs

@ -417,7 +417,7 @@ namespace ICSharpCode.TextEditor @@ -417,7 +417,7 @@ namespace ICSharpCode.TextEditor
public void JumpTo(int line)
{
line = Math.Min(line, Document.TotalNumberOfLines - 1);
line = Math.Max(0, Math.Min(line, Document.TotalNumberOfLines - 1));
string text = Document.GetText(Document.GetLineSegment(line));
JumpTo(line, text.Length - text.TrimStart().Length);
}

Loading…
Cancel
Save