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 20 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 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -344,9 +344,13 @@ namespace ICSharpCode.Core @@ -344,9 +344,13 @@ namespace ICSharpCode.Core
void RemoveClass(IClass @class)
{
string fullClassName = @class.FullyQualifiedName;
if (!GetClasses(language).ContainsKey(fullClassName)) {
return;
}
if (@class.IsPartial) {
// remove a part of a partial class
CompoundClass compound = (CompoundClass)GetClasses(language)[@class.FullyQualifiedName];
CompoundClass compound = (CompoundClass)GetClasses(language)[fullClassName];
compound.Parts.Remove(@class);
if (compound.Parts.Count > 0) {
compound.UpdateInformationFromParts();
@ -359,7 +363,7 @@ namespace ICSharpCode.Core @@ -359,7 +363,7 @@ namespace ICSharpCode.Core
if (nSpace == null) {
nSpace = String.Empty;
}
RemoveClass(@class.FullyQualifiedName, nSpace);
RemoveClass(fullClassName, 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 @@ -27,8 +27,6 @@ namespace SearchAndReplace
SizeF spaceSize;
static StringFormat sf = (StringFormat)System.Drawing.StringFormat.GenericTypographic.Clone();
LineSegment line;
Point startPosition;
Point endPosition;
string positionText;
@ -50,10 +48,14 @@ namespace SearchAndReplace @@ -50,10 +48,14 @@ namespace SearchAndReplace
string DisplayText {
get {
if (specialText != null)
if (specialText != null) {
return positionText + specialText;
else
} else if (document.TotalNumberOfLines > startPosition.Y) {
LineSegment line = document.GetLineSegment(startPosition.Y);
return positionText + document.GetText(line).Replace("\t", " ");
} else {
return positionText;
}
}
}
string FileNameText {
@ -70,7 +72,6 @@ namespace SearchAndReplace @@ -70,7 +72,6 @@ namespace SearchAndReplace
endPosition = result.GetEndPosition(document);
positionText = "(" + (startPosition.Y + 1) + ", " + (startPosition.X + 1) + ") ";
line = document.GetLineSegment(startPosition.Y);
specialText = result.DisplayText;
Text = DisplayText;
}
@ -95,7 +96,7 @@ namespace SearchAndReplace @@ -95,7 +96,7 @@ namespace SearchAndReplace
if (specialText != null) {
DrawText(g, specialText, Brushes.Black, Font, ref x, e.Bounds.Y);
} else {
x += DrawLine(g, line, e.Bounds.Y, x);
x += DrawLine(g, document.GetLineSegment(startPosition.Y), e.Bounds.Y, x);
}
if (ShowFileName) {
x += DrawDocumentWord(g,

Loading…
Cancel
Save