mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 19:16:16 +02:00
codetools: moved AdjustPositionAfterInsert
git-svn-id: trunk@14280 -
This commit is contained in:
parent
ce09782485
commit
e748b6291f
@ -121,6 +121,8 @@ function CountNeededLineEndsToAddForward(const Src: string;
|
||||
StartPos, MinLineEnds: integer): integer;
|
||||
function CountNeededLineEndsToAddBackward(const Src: string;
|
||||
StartPos, MinLineEnds: integer): integer;
|
||||
procedure AdjustPositionAfterInsert(var p: integer; IsStart: boolean;
|
||||
FromPos, ToPos, DiffPos: integer);
|
||||
|
||||
// comparison
|
||||
function CompareText(Txt1: PChar; Len1: integer; Txt2: PChar; Len2: integer;
|
||||
@ -4061,6 +4063,27 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure AdjustPositionAfterInsert(var p: integer; IsStart: boolean; FromPos,
|
||||
ToPos, DiffPos: integer);
|
||||
begin
|
||||
if (ToPos>FromPos) then begin
|
||||
// replace
|
||||
if p>FromPos then begin
|
||||
if p>ToPos then
|
||||
inc(p,DiffPos)
|
||||
else
|
||||
p:=FromPos;
|
||||
end;
|
||||
end else begin
|
||||
// insert
|
||||
if IsStart then begin
|
||||
if p>=FromPos then inc(p,DiffPos);
|
||||
end else begin
|
||||
if p>FromPos then inc(p,DiffPos);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CompareText(Txt1: PChar; Len1: integer; Txt2: PChar; Len2: integer;
|
||||
CaseSensitive: boolean): integer;
|
||||
begin
|
||||
|
@ -274,9 +274,6 @@ function ComparePCharWithH2PasFuncName(Name, H2PasFunc: Pointer): integer;
|
||||
function CDNodeDescAsString(Desc: TCompilerDirectiveNodeDesc): string;
|
||||
function CDNodeSubDescAsString(Desc: TCompilerDirectiveNodeDesc): string;
|
||||
|
||||
procedure AdjustPositionAfterInsert(var p: integer; IsStart: boolean;
|
||||
FromPos, ToPos, DiffPos: integer);
|
||||
|
||||
implementation
|
||||
|
||||
type
|
||||
@ -391,27 +388,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure AdjustPositionAfterInsert(var p: integer;
|
||||
IsStart: boolean; FromPos, ToPos, DiffPos: integer);
|
||||
begin
|
||||
if (ToPos>FromPos) then begin
|
||||
// replace
|
||||
if p>FromPos then begin
|
||||
if p>ToPos then
|
||||
inc(p,DiffPos)
|
||||
else
|
||||
p:=FromPos;
|
||||
end;
|
||||
end else begin
|
||||
// insert
|
||||
if IsStart then begin
|
||||
if p>=FromPos then inc(p,DiffPos);
|
||||
end else begin
|
||||
if p>FromPos then inc(p,DiffPos);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TCompilerDirectivesTree }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user