diff --git a/components/codetools/examples/replaceresourcedirectives.lpi b/components/codetools/examples/replaceresourcedirectives.lpi index 2e358f18ae..e0213b5def 100644 --- a/components/codetools/examples/replaceresourcedirectives.lpi +++ b/components/codetools/examples/replaceresourcedirectives.lpi @@ -27,10 +27,10 @@ - + - + diff --git a/components/codetools/examples/replaceresourcedirectives.lpr b/components/codetools/examples/replaceresourcedirectives.lpr index cb6ea257c1..109e59da19 100644 --- a/components/codetools/examples/replaceresourcedirectives.lpr +++ b/components/codetools/examples/replaceresourcedirectives.lpr @@ -37,6 +37,7 @@ var NewCode: TCodeBuffer; NewX, NewY, NewTopLine: integer; begin + aResY // load the file if ParamCount>=1 then Filename:=ExpandFileName(ParamStr(1)) diff --git a/ide/uniteditor.pp b/ide/uniteditor.pp index 5ebd17039f..930af1892e 100644 --- a/ide/uniteditor.pp +++ b/ide/uniteditor.pp @@ -2120,15 +2120,26 @@ var Line: String; CatName: String; SrcToken: String; + IdChars: TSynIdentChars; + WordToken: String; begin Result:=false; Line:=GetLineText; p:=GetCursorTextXY; if (p.x>length(Line)+1) or (Line='') then exit; CatName:=AutoCompleteOptionNames[Category]; + WordToken:=FEditor.GetWordAtRowCol(p); + if Assigned(FEditor.Highlighter) then + IdChars := FEditor.Highlighter.IdentChars + else + IdChars := ['a'..'z', 'A'..'Z']; for i:=0 to FCodeTemplates.Completions.Count-1 do begin AToken:=FCodeTemplates.Completions[i]; - SrcToken:=copy(Line,length(Line)-length(AToken)+1,length(AToken)); + if AToken='' then continue; + if AToken[1] in IdChars then + SrcToken:=WordToken + else + SrcToken:=copy(Line,length(Line)-length(AToken)+1,length(AToken)); //DebugLn(['TSourceEditor.AutoCompleteChar ',AToken,' SrcToken=',SrcToken,' CatName=',CatName,' Index=',FCodeTemplates.CompletionAttributes[i].IndexOfName(CatName)]); if (AnsiCompareText(AToken,SrcToken)=0) and (FCodeTemplates.CompletionAttributes[i].IndexOfName(CatName)>=0)