Browse Source

Fixed bug in search pad when document was changed after the search.

Fixed crash when two classes with the same name were removed from a project content.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@445 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
cf74204194
  1. 10
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  2. 13
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

10
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -1,4 +1,4 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright> // <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license> // <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> // <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -344,9 +344,13 @@ namespace ICSharpCode.Core
void RemoveClass(IClass @class) void RemoveClass(IClass @class)
{ {
string fullClassName = @class.FullyQualifiedName;
if (!GetClasses(language).ContainsKey(fullClassName)) {
return;
}
if (@class.IsPartial) { if (@class.IsPartial) {
// remove a part of a partial class // remove a part of a partial class
CompoundClass compound = (CompoundClass)GetClasses(language)[@class.FullyQualifiedName]; CompoundClass compound = (CompoundClass)GetClasses(language)[fullClassName];
compound.Parts.Remove(@class); compound.Parts.Remove(@class);
if (compound.Parts.Count > 0) { if (compound.Parts.Count > 0) {
compound.UpdateInformationFromParts(); compound.UpdateInformationFromParts();
@ -359,7 +363,7 @@ namespace ICSharpCode.Core
if (nSpace == null) { if (nSpace == null) {
nSpace = String.Empty; nSpace = String.Empty;
} }
RemoveClass(@class.FullyQualifiedName, nSpace); RemoveClass(fullClassName, nSpace);
} }
void RemoveClass(string fullyQualifiedName, string nSpace) void RemoveClass(string fullyQualifiedName, string nSpace)

13
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

@ -27,8 +27,6 @@ namespace SearchAndReplace
SizeF spaceSize; SizeF spaceSize;
static StringFormat sf = (StringFormat)System.Drawing.StringFormat.GenericTypographic.Clone(); static StringFormat sf = (StringFormat)System.Drawing.StringFormat.GenericTypographic.Clone();
LineSegment line;
Point startPosition; Point startPosition;
Point endPosition; Point endPosition;
string positionText; string positionText;
@ -50,10 +48,14 @@ namespace SearchAndReplace
string DisplayText { string DisplayText {
get { get {
if (specialText != null) if (specialText != null) {
return positionText + specialText; return positionText + specialText;
else } else if (document.TotalNumberOfLines > startPosition.Y) {
LineSegment line = document.GetLineSegment(startPosition.Y);
return positionText + document.GetText(line).Replace("\t", " "); return positionText + document.GetText(line).Replace("\t", " ");
} else {
return positionText;
}
} }
} }
string FileNameText { string FileNameText {
@ -70,7 +72,6 @@ namespace SearchAndReplace
endPosition = result.GetEndPosition(document); endPosition = result.GetEndPosition(document);
positionText = "(" + (startPosition.Y + 1) + ", " + (startPosition.X + 1) + ") "; positionText = "(" + (startPosition.Y + 1) + ", " + (startPosition.X + 1) + ") ";
line = document.GetLineSegment(startPosition.Y);
specialText = result.DisplayText; specialText = result.DisplayText;
Text = DisplayText; Text = DisplayText;
} }
@ -95,7 +96,7 @@ namespace SearchAndReplace
if (specialText != null) { if (specialText != null) {
DrawText(g, specialText, Brushes.Black, Font, ref x, e.Bounds.Y); DrawText(g, specialText, Brushes.Black, Font, ref x, e.Bounds.Y);
} else { } else {
x += DrawLine(g, line, e.Bounds.Y, x); x += DrawLine(g, document.GetLineSegment(startPosition.Y), e.Bounds.Y, x);
} }
if (ShowFileName) { if (ShowFileName) {
x += DrawDocumentWord(g, x += DrawDocumentWord(g,

Loading…
Cancel
Save