diff --git a/components/codetools/sourcechanger.pas b/components/codetools/sourcechanger.pas index 987b8a7c53..9ee565e29d 100644 --- a/components/codetools/sourcechanger.pas +++ b/components/codetools/sourcechanger.pas @@ -374,12 +374,14 @@ begin writeln('DirectCode=',DirectCode.Filename,' DirectPos=',FromDirectPos,'-',ToDirectPos); {$ENDIF} Result:=false; - if (MainScanner=nil) or (FromPos>ToPos) or (FromPos<1) - or (ToPos>MainScanner.CleanedLen+1) then - exit; IsDirectChange:=DirectCode<>nil; + if not IsDirectChange then begin + if (MainScanner=nil) or (FromPos>ToPos) or (FromPos<1) + or (ToPos>MainScanner.CleanedLen+1) then + exit; + end; if FindEntryInRange(FromPos,ToPos)<>nil then exit; - + if ToPos>FromPos then begin // this is a delete operation -> check the whole range for writable buffers if not MainScanner.WholeRangeIsWritable(FromPos,ToPos) then exit; @@ -581,7 +583,7 @@ begin InsertText:=FirstEntry.Text; // add after gap AddAfterGap(FirstEntry); - // add text from nodes inserted at the same position + // add text from every nodes inserted at the same position PrecNode:=FEntries.FindPrecessor(CurNode); CurEntry:=FirstEntry; while (PrecNode<>nil) do begin diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index 5f1933baa9..4a0269063c 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -1064,12 +1064,18 @@ begin if (OldFormName='') or (OldFormClassName='') or (NewFormName='') or (NewFormClassName='') or (SourceChangeCache=nil) then exit; + if (OldFormName=NewFormName) + and (OldFormClassName=NewFormClassName) then exit; IdentList:=TStringList.Create; try - IdentList.Add(OldFormName); - IdentList.Add(NewFormName); - IdentList.Add(OldFormClassName); - IdentList.Add(NewFormClassName); + if (OldFormName<>NewFormName) then begin + IdentList.Add(OldFormName); + IdentList.Add(NewFormName); + end; + if (OldFormClassName<>NewFormClassName) then begin + IdentList.Add(OldFormClassName); + IdentList.Add(NewFormClassName); + end; Result:=ReplaceIdentifiers(IdentList,SourceChangeCache); finally IdentList.Free; @@ -1097,6 +1103,7 @@ function TStandardCodeTool.ReplaceIdentifiers(IdentList: TStrings; MaxPos:=length(CurSource); StartPos:=1; // go through all source parts between compiler directives + writeln('TStandardCodeTool.ReplaceIdentifiers ',ACode.Filename); repeat EndPos:=FindNextCompilerDirective(CurSource,StartPos, Scanner.NestedComments); @@ -1107,11 +1114,16 @@ function TStandardCodeTool.ReplaceIdentifiers(IdentList: TStrings; if IdentStart'') + and (BasicCodeTools.CompareIdentifiers(PChar(IdentList[i]), + @CurSource[IdentStart])=0) + and (IdentList[i]<>IdentList[i+1]) then begin // identifier found -> replace IdentEnd:=IdentStart+length(IdentList[i]); + writeln('TStandardCodeTool.ReplaceIdentifiers replacing: ', + ' "',copy(CurSource,IdentStart,IdentEnd-IdentStart),'" -> "',IdentList[i+1],'" at ',IdentStart + ); SourceChangeCache.ReplaceEx(gtNone,gtNone,1,1, ACode,IdentStart,IdentEnd,IdentList[i+1]); break; diff --git a/ide/project.pp b/ide/project.pp index 4d4d09b7d5..f25f608d48 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -1498,8 +1498,8 @@ function TProject.IndexOfUnitWithFormName(const AFormName: string; begin Result:=UnitCount-1; while (Result>=0) do begin - if (OnlyProjectUnits and Units[Result].IsPartOfProject) - or (not OnlyProjectUnits) + if ((OnlyProjectUnits and Units[Result].IsPartOfProject) + or (not OnlyProjectUnits)) and (IgnoreUnit<>Units[Result]) then begin if (AnsiCompareText(Units[Result].FormName,AFormName)=0) or ((Units[Result].Form<>nil) @@ -2066,6 +2066,9 @@ end. { $Log$ + Revision 1.82 2002/10/04 21:31:56 lazarus + MG: added some component rename checks + Revision 1.81 2002/10/02 16:16:39 lazarus MG: accelerated unitdependencies