mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 21:39:31 +01:00
codetools: fixed check if cursor pos inside scanned range
git-svn-id: trunk@29791 -
This commit is contained in:
parent
25dee90ae8
commit
ae61921ef1
@ -4614,11 +4614,8 @@ procedure TPascalParserTool.BuildTreeAndGetCleanPos(TreeRange: TTreeRange;
|
|||||||
var
|
var
|
||||||
CaretType: integer;
|
CaretType: integer;
|
||||||
IgnorePos: TCodePosition;
|
IgnorePos: TCodePosition;
|
||||||
RealTreeRange: TTreeRange;
|
|
||||||
Node: TCodeTreeNode;
|
Node: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
RealTreeRange:=TreeRange;
|
|
||||||
|
|
||||||
//DebugLn(['TPascalParserTool.BuildTreeAndGetCleanPos ',MainFilename,' btSetIgnoreErrorPos=',btSetIgnoreErrorPos in BuildTreeFlags,' btKeepIgnoreErrorPos=',btKeepIgnoreErrorPos in BuildTreeFlags,' CursorPos=x=',CursorPos.X,',y=',CursorPos.Y]);
|
//DebugLn(['TPascalParserTool.BuildTreeAndGetCleanPos ',MainFilename,' btSetIgnoreErrorPos=',btSetIgnoreErrorPos in BuildTreeFlags,' btKeepIgnoreErrorPos=',btKeepIgnoreErrorPos in BuildTreeFlags,' CursorPos=x=',CursorPos.X,',y=',CursorPos.Y]);
|
||||||
if (btSetIgnoreErrorPos in BuildTreeFlags) then begin
|
if (btSetIgnoreErrorPos in BuildTreeFlags) then begin
|
||||||
// ignore errors after cursor position
|
// ignore errors after cursor position
|
||||||
@ -4634,17 +4631,17 @@ begin
|
|||||||
else if not (btKeepIgnoreErrorPos in BuildTreeFlags) then
|
else if not (btKeepIgnoreErrorPos in BuildTreeFlags) then
|
||||||
ClearIgnoreErrorAfter;
|
ClearIgnoreErrorAfter;
|
||||||
|
|
||||||
if (RealTreeRange in [trTillCursor,trTillCursorSection]) then begin
|
if (TreeRange in [trTillCursor,trTillCursorSection]) then begin
|
||||||
ScanRange:=lsrEnd;
|
ScanRange:=lsrEnd;
|
||||||
// check if cursor position is in scanned range
|
// check if cursor position is in scanned range
|
||||||
if (Tree<>nil) and (Tree.Root<>nil) then begin
|
if (Tree<>nil) and (Tree.Root<>nil) then begin
|
||||||
CaretType:=CaretToCleanPos(CursorPos, CleanCursorPos);
|
CaretType:=CaretToCleanPos(CursorPos, CleanCursorPos);
|
||||||
if (CaretType=0) or (CaretType=-1) then begin
|
if (CaretType=0) or (CaretType=-1) then begin
|
||||||
Node:=FindScanRangeNodeAtPos(CleanCursorPos);
|
Node:=FindSectionNodeAtPos(CleanCursorPos);
|
||||||
if Node<>nil then begin
|
if (Node<>nil) and (Node.EndPos>CleanCursorPos) then begin
|
||||||
// cursor in scanned range
|
// cursor in scanned range
|
||||||
ScanRange:=ScannedRange;
|
ScanRange:=ScannedRange;
|
||||||
if (RealTreeRange=trTillCursorSection) and (ScanRange<>lsrEnd) then
|
if (TreeRange=trTillCursorSection) and (ScanRange<>lsrEnd) then
|
||||||
inc(ScanRange);
|
inc(ScanRange);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user