mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 18:39:05 +02:00
SynEdit: wrap, refactor GetLineForForWrap into NodeHolder
git-svn-id: trunk@63661 -
This commit is contained in:
parent
4649c9029a
commit
9de9851213
@ -149,6 +149,8 @@ function GetWrappedOffsetFor(ARealOffset: IntIdx): IntIdx; virtual; abstract;
|
|||||||
function RealStartLine: Integer; // Offset
|
function RealStartLine: Integer; // Offset
|
||||||
function RealEndLine: Integer; // Offset + RealCount - 1;
|
function RealEndLine: Integer; // Offset + RealCount - 1;
|
||||||
|
|
||||||
|
function GetLineForForWrap(AWrapLine: TLineIdx; out AWrapOffset: TLineIdx): TLineIdx;
|
||||||
|
|
||||||
function TextXYIdxToViewXYIdx(ATextXYIdx: TPhysPoint): TPhysPoint;
|
function TextXYIdxToViewXYIdx(ATextXYIdx: TPhysPoint): TPhysPoint;
|
||||||
function ViewXYIdxToTextXYIdx(AViewXYIdx: TPhysPoint): TPhysPoint;
|
function ViewXYIdxToTextXYIdx(AViewXYIdx: TPhysPoint): TPhysPoint;
|
||||||
|
|
||||||
@ -802,6 +804,19 @@ begin
|
|||||||
Result := FStartLine + FData.RealEndLine;
|
Result := FStartLine + FData.RealEndLine;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditLineMapPageHolder.GetLineForForWrap(AWrapLine: TLineIdx; out
|
||||||
|
AWrapOffset: TLineIdx): TLineIdx;
|
||||||
|
begin
|
||||||
|
if (not HasPage) or (StartLine + ViewedCountDifferenceBefore > AWrapLine) then begin
|
||||||
|
// no wrapped line before AWrapLine;
|
||||||
|
Result := AWrapLine;
|
||||||
|
AWrapOffset := 0;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := StartLine + Page.GetOffsetForWrap(AWrapLine - StartLine - ViewedCountDifferenceBefore, AWrapOffset);
|
||||||
|
end;
|
||||||
|
|
||||||
function TSynEditLineMapPageHolder.TextXYIdxToViewXYIdx(ATextXYIdx: TPhysPoint
|
function TSynEditLineMapPageHolder.TextXYIdxToViewXYIdx(ATextXYIdx: TPhysPoint
|
||||||
): TPhysPoint;
|
): TPhysPoint;
|
||||||
begin
|
begin
|
||||||
@ -1243,21 +1258,8 @@ var
|
|||||||
pg: TSynEditLineMapPageHolder;
|
pg: TSynEditLineMapPageHolder;
|
||||||
begin
|
begin
|
||||||
pg := FindPageForWrap(AWrapLine);
|
pg := FindPageForWrap(AWrapLine);
|
||||||
if not pg.HasPage then begin
|
|
||||||
Result := 0;
|
|
||||||
AWrapOffset := 0;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if pg.StartLine + pg.ViewedCountDifferenceBefore > AWrapLine then begin
|
|
||||||
// no wrapped line before AWrapLine;
|
|
||||||
Result := AWrapLine;
|
|
||||||
AWrapOffset := 0;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// TODO: this may be the next node.
|
// TODO: this may be the next node.
|
||||||
Result := pg.StartLine + pg.Page.GetOffsetForWrap(AWrapLine - pg.StartLine - pg.ViewedCountDifferenceBefore, AWrapOffset);
|
Result := pg.GetLineForForWrap(AWrapLine, AWrapOffset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynLineMapAVLTree.TextXYIdxToViewXYIdx(ATextXYIdx: TPhysPoint
|
function TSynLineMapAVLTree.TextXYIdxToViewXYIdx(ATextXYIdx: TPhysPoint
|
||||||
|
Loading…
Reference in New Issue
Block a user