mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:19:22 +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;
|
function CleanPosToCaretAndTopLine(CleanPos: integer;
|
||||||
out Caret:TCodeXYPosition; out NewTopLine: integer): boolean; // true=ok, false=invalid CleanPos
|
out Caret:TCodeXYPosition; out NewTopLine: integer): boolean; // true=ok, false=invalid CleanPos
|
||||||
function CleanPosToStr(CleanPos: integer; WithFilename: boolean = false): string;
|
function CleanPosToStr(CleanPos: integer; WithFilename: boolean = false): string;
|
||||||
|
function CodeXYToStr(const CodePos: TCodeXYPosition; WithFilename: boolean = false): string;
|
||||||
function CleanPosToRelativeStr(CleanPos: integer;
|
function CleanPosToRelativeStr(CleanPos: integer;
|
||||||
const BaseFilename: string): string;
|
const BaseFilename: string): string;
|
||||||
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
||||||
@ -2704,12 +2705,18 @@ var
|
|||||||
CodePos: TCodeXYPosition;
|
CodePos: TCodeXYPosition;
|
||||||
begin
|
begin
|
||||||
if CleanPosToCaret(CleanPos,CodePos) then begin
|
if CleanPosToCaret(CleanPos,CodePos) then begin
|
||||||
|
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:='';
|
Result:='';
|
||||||
if WithFilename then
|
if WithFilename then
|
||||||
Result:=ExtractRelativepath(ExtractFilePath(MainFilename),CodePos.Code.Filename)+',';
|
Result:=ExtractRelativepath(ExtractFilePath(MainFilename),CodePos.Code.Filename)+',';
|
||||||
Result:=Result+'line '+IntToStr(CodePos.Y)+', column '+IntToStr(CodePos.X);
|
Result:=Result+'line '+IntToStr(CodePos.Y)+', column '+IntToStr(CodePos.X);
|
||||||
end else
|
|
||||||
Result:='outside scan range, pos='+IntToStr(CleanPos)+'('+dbgstr(copy(Src,CleanPos-5,5)+'|'+copy(Src,CleanPos,5))+')';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomCodeTool.CleanPosToRelativeStr(CleanPos: integer;
|
function TCustomCodeTool.CleanPosToRelativeStr(CleanPos: integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user