mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 11:19:26 +02:00
codetools: TLinkScanner.CleanedPosToCursor: fixed when pos at artifical code, issue #22852
git-svn-id: trunk@38615 -
This commit is contained in:
parent
82fd01ca5c
commit
3ba660c99f
@ -3972,6 +3972,26 @@ function TLinkScanner.CleanedPosToCursor(ACleanedPos: integer;
|
||||
'TLinkScanner.CleanedPosToCursor Consistency-Error '+IntToStr(i));
|
||||
end;
|
||||
|
||||
procedure ConsistencyCheckStart;
|
||||
begin
|
||||
raise Exception.Create(
|
||||
'TLinkScanner.CleanedPosToCursor Consistency-Error no start link with code found');
|
||||
end;
|
||||
|
||||
procedure Found(LinkID: integer);
|
||||
begin
|
||||
ACode:=FLinks[LinkID].Code;
|
||||
if ACode=nil then begin
|
||||
repeat
|
||||
dec(LinkID);
|
||||
if LinkID<0 then
|
||||
ConsistencyCheckStart;
|
||||
ACode:=FLinks[LinkID].Code;
|
||||
until ACode<>nil;
|
||||
end;
|
||||
ACursorPos:=ACleanedPos-FLinks[LinkID].CleanedPos+FLinks[LinkID].SrcPos;
|
||||
end;
|
||||
|
||||
var l,r,m: integer;
|
||||
begin
|
||||
Result:=(ACleanedPos>=1) and (ACleanedPos<=CleanedLen);
|
||||
@ -3987,14 +4007,12 @@ begin
|
||||
else if ACleanedPos>=FLinks[m+1].CleanedPos then
|
||||
l:=m+1
|
||||
else begin
|
||||
ACode:=FLinks[m].Code;
|
||||
ACursorPos:=ACleanedPos-FLinks[m].CleanedPos+FLinks[m].SrcPos;
|
||||
Found(m);
|
||||
exit;
|
||||
end;
|
||||
end else begin
|
||||
if ACleanedPos>=FLinks[m].CleanedPos then begin
|
||||
ACode:=FLinks[m].Code;
|
||||
ACursorPos:=ACleanedPos-FLinks[m].CleanedPos+FLinks[m].SrcPos;
|
||||
Found(m);
|
||||
exit;
|
||||
end else
|
||||
ConsistencyCheckI(2);
|
||||
|
@ -775,10 +775,6 @@ begin
|
||||
// clear old items
|
||||
CurFile.Clear;
|
||||
|
||||
// Display file name being processed
|
||||
//StatusBar.SimpleText := aFileName;
|
||||
//StatusBar.Repaint;
|
||||
|
||||
Src:=Tool.Src;
|
||||
p:=1;
|
||||
NestedComment:=CodeToolBoss.GetNestedCommentsFlagForFile(Code.Filename);
|
||||
|
Loading…
Reference in New Issue
Block a user