mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 10:36:20 +02:00
codetools: CodeXYToStr
git-svn-id: trunk@48538 -
This commit is contained in:
parent
ca91821012
commit
ff25f13519
@ -182,6 +182,7 @@ type
|
||||
function CleanPosToCaretAndTopLine(CleanPos: integer;
|
||||
out Caret:TCodeXYPosition; out NewTopLine: integer): boolean; // true=ok, false=invalid CleanPos
|
||||
function CleanPosToStr(CleanPos: integer; WithFilename: boolean = false): string;
|
||||
function CodeXYToStr(const CodePos: TCodeXYPosition; WithFilename: boolean = false): string;
|
||||
function CleanPosToRelativeStr(CleanPos: integer;
|
||||
const BaseFilename: string): string;
|
||||
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
||||
@ -2704,14 +2705,20 @@ var
|
||||
CodePos: TCodeXYPosition;
|
||||
begin
|
||||
if CleanPosToCaret(CleanPos,CodePos) then begin
|
||||
Result:='';
|
||||
if WithFilename then
|
||||
Result:=ExtractRelativepath(ExtractFilePath(MainFilename),CodePos.Code.Filename)+',';
|
||||
Result:=Result+'line '+IntToStr(CodePos.Y)+', column '+IntToStr(CodePos.X);
|
||||
Result:=CodeXYToStr(CodePos,WithFilename);
|
||||
end else
|
||||
Result:='outside scan range, pos='+IntToStr(CleanPos)+'('+dbgstr(copy(Src,CleanPos-5,5)+'|'+copy(Src,CleanPos,5))+')';
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.CodeXYToStr(const CodePos: TCodeXYPosition;
|
||||
WithFilename: boolean): string;
|
||||
begin
|
||||
Result:='';
|
||||
if WithFilename then
|
||||
Result:=ExtractRelativepath(ExtractFilePath(MainFilename),CodePos.Code.Filename)+',';
|
||||
Result:=Result+'line '+IntToStr(CodePos.Y)+', column '+IntToStr(CodePos.X);
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.CleanPosToRelativeStr(CleanPos: integer;
|
||||
const BaseFilename: string): string;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user