mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:21:04 +02:00
SynEdit: More paint-token-breaker for future bidi support
git-svn-id: trunk@38970 -
This commit is contained in:
parent
6ba263edec
commit
a78f8422f5
@ -14,21 +14,28 @@ uses
|
|||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
//TLazSynDisplayTokenBound = record
|
||||||
|
// Physical: Integer; // 1 based
|
||||||
|
// Logical: Integer; // 1 based
|
||||||
|
// Offset: Integer; // default 0. MultiWidth (e.g. Tab), if token starts in the middle of char
|
||||||
|
//end;
|
||||||
|
|
||||||
TLazSynDisplayTokenInfoEx = record
|
TLazSynDisplayTokenInfoEx = record
|
||||||
Tk: TLazSynDisplayTokenInfo;
|
Tk: TLazSynDisplayTokenInfo;
|
||||||
LogicalStart: Integer; // 1 based. First char in line starts at 1 (This is Bytes not Chars)
|
//StartPos: TLazSynDisplayTokenBound;
|
||||||
LogicalEnd: Integer; // 1 based. First char in line ends after char // NextChar-Start
|
//EndPos: TLazSynDisplayTokenBound;
|
||||||
PhysicalStart: Integer; // 1 based Includes any half (from double-width) char, that overlaps, the PhysPaint borders
|
LogicalStart: Integer; // 1 based. First char in line starts at 1 (This is Bytes not Chars)
|
||||||
PhysicalEnd: Integer; // 1 based
|
LogicalEnd: Integer; // 1 based. First char in line ends after char // NextChar-Start
|
||||||
PhysicalPaintStart: Integer; // 1 based
|
PhysicalStart: Integer; // 1 based Includes any half (from double-width) char, that overlaps, the PhysPaint borders
|
||||||
PhysicalPaintEnd: Integer; // 1 based
|
PhysicalEnd: Integer; // 1 based
|
||||||
|
PhysicalPaintStart: Integer; // 1 based
|
||||||
|
PhysicalPaintEnd: Integer; // 1 based
|
||||||
IsRtl: boolean;
|
IsRtl: boolean;
|
||||||
ExpandedExtraBytes: Integer; // tab and space expansion
|
ExpandedExtraBytes: Integer; // tab and space expansion
|
||||||
HasDoubleWidth: Boolean;
|
HasDoubleWidth: Boolean;
|
||||||
Attr: TSynSelectedColor;
|
Attr: TSynSelectedColor;
|
||||||
NextPhysicalPaintStart: Integer; // 1 based - Next toxen, may be BIDI
|
NextPhysicalPaintStart: Integer; // 1 based - Next toxen, may be BIDI
|
||||||
NextLogicStart: Integer; // 1 based - Next toxen, may be BIDI
|
NextLogicStart: Integer; // 1 based - Next toxen, may be BIDI
|
||||||
NextLogicStartPhysOffs: Integer; // default 0. MultiWidth (e.g. Tab), if token starts in the middle of char
|
NextLogicStartPhysOffs: Integer; // default 0. MultiWidth (e.g. Tab), if token starts in the middle of char
|
||||||
NextIsRtl: boolean;
|
NextIsRtl: boolean;
|
||||||
end;
|
end;
|
||||||
@ -52,6 +59,7 @@ type
|
|||||||
FCurTxtLineIdx : Integer;
|
FCurTxtLineIdx : Integer;
|
||||||
|
|
||||||
FCurViewToken: TLazSynDisplayTokenInfoEx;
|
FCurViewToken: TLazSynDisplayTokenInfoEx;
|
||||||
|
FCurViewTokenViewPhysStart: Integer;
|
||||||
FCurViewinRTL: Boolean;
|
FCurViewinRTL: Boolean;
|
||||||
FCurViewRtlPhysEnd: integer;
|
FCurViewRtlPhysEnd: integer;
|
||||||
FCurViewRtlLogEnd: integer;
|
FCurViewRtlLogEnd: integer;
|
||||||
@ -332,6 +340,7 @@ function TLazSynPaintTokenBreaker.GetNextHighlighterTokenFromView(out
|
|||||||
begin
|
begin
|
||||||
Result := FCurViewToken.Tk.TokenLength > 0;
|
Result := FCurViewToken.Tk.TokenLength > 0;
|
||||||
if Result or (FCurViewToken.Tk.TokenLength < 0) then exit;
|
if Result or (FCurViewToken.Tk.TokenLength < 0) then exit;
|
||||||
|
FCurViewTokenViewPhysStart := FCurViewToken.PhysicalStart;
|
||||||
while FCurViewToken.Tk.TokenLength = 0 do begin // Todo: is SyncroEd-test a zero size token is returned
|
while FCurViewToken.Tk.TokenLength = 0 do begin // Todo: is SyncroEd-test a zero size token is returned
|
||||||
Result := FDisplayView.GetNextHighlighterToken(FCurViewToken.Tk);
|
Result := FDisplayView.GetNextHighlighterToken(FCurViewToken.Tk);
|
||||||
if not Result then begin
|
if not Result then begin
|
||||||
@ -340,8 +349,6 @@ function TLazSynPaintTokenBreaker.GetNextHighlighterTokenFromView(out
|
|||||||
end;
|
end;
|
||||||
// Todo: concatenate with next token, if possible (only, if reaching token end)
|
// Todo: concatenate with next token, if possible (only, if reaching token end)
|
||||||
end;
|
end;
|
||||||
// TODO: wait with attr, if skipping none painted
|
|
||||||
InitSynAttr(FCurViewToken.Attr, FCurViewToken.Tk.TokenAttr, FCurViewToken.PhysicalStart);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetCharWidthData(AIdx: Integer): TPhysicalCharWidth; inline;
|
function GetCharWidthData(AIdx: Integer): TPhysicalCharWidth; inline;
|
||||||
@ -591,16 +598,18 @@ begin
|
|||||||
FCurViewToken.PhysicalPaintStart := PhysTokenStop;
|
FCurViewToken.PhysicalPaintStart := PhysTokenStop;
|
||||||
|
|
||||||
assert(FCurViewToken.Tk.TokenLength >= 0, 'FCurViewToken.Tk.TokenLength >= 0');
|
assert(FCurViewToken.Tk.TokenLength >= 0, 'FCurViewToken.Tk.TokenLength >= 0');
|
||||||
|
|
||||||
|
InitSynAttr(FCurViewToken.Attr, FCurViewToken.Tk.TokenAttr, FCurViewTokenViewPhysStart);
|
||||||
if FCurViewToken.Tk.TokenLength = 0 then
|
if FCurViewToken.Tk.TokenLength = 0 then
|
||||||
ATokenInfo.Attr.EndX := PhysPos-1;
|
ATokenInfo.Attr.EndX := PhysPos-1;
|
||||||
|
|
||||||
//MaybeFetchToken;
|
MaybeFetchToken;
|
||||||
//if MaybeChangeToRtl(LogicIdx, LogicEnd) then begin // get NextTokenPhysStart
|
if MaybeChangeToRtl(LogicIdx, LogicEnd) then begin // get NextTokenPhysStart
|
||||||
// SkipRtlOffScreen(LogicIdx, LogicEnd);
|
SkipRtlOffScreen(LogicIdx, LogicEnd);
|
||||||
// while FCurViewToken.Tk.TokenLength = 0 do
|
while FCurViewToken.Tk.TokenLength = 0 do
|
||||||
// if MaybeFetchToken then
|
if MaybeFetchToken then
|
||||||
// SkipRtlOffScreen(LogicIdx, LogicEnd);
|
SkipRtlOffScreen(LogicIdx, LogicEnd);
|
||||||
//end;
|
end;
|
||||||
|
|
||||||
ATokenInfo.NextPhysicalPaintStart := FCurViewToken.PhysicalPaintStart;
|
ATokenInfo.NextPhysicalPaintStart := FCurViewToken.PhysicalPaintStart;
|
||||||
ATokenInfo.NextLogicStart := FCurViewToken.LogicalStart;
|
ATokenInfo.NextLogicStart := FCurViewToken.LogicalStart;
|
||||||
@ -689,15 +698,17 @@ begin
|
|||||||
FCurViewToken.PhysicalPaintStart := PhysTokenStop;
|
FCurViewToken.PhysicalPaintStart := PhysTokenStop;
|
||||||
|
|
||||||
assert(FCurViewToken.Tk.TokenLength >= 0, 'FCurViewToken.Tk.TokenLength >= 0');
|
assert(FCurViewToken.Tk.TokenLength >= 0, 'FCurViewToken.Tk.TokenLength >= 0');
|
||||||
|
|
||||||
|
InitSynAttr(FCurViewToken.Attr, FCurViewToken.Tk.TokenAttr, FCurViewTokenViewPhysStart);
|
||||||
if FCurViewToken.Tk.TokenLength = 0 then
|
if FCurViewToken.Tk.TokenLength = 0 then
|
||||||
ATokenInfo.Attr.EndX := PhysPos-1;
|
ATokenInfo.Attr.EndX := PhysPos-1;
|
||||||
|
|
||||||
//MaybeFetchToken;
|
MaybeFetchToken;
|
||||||
//SkipRtlOffScreen(LogicIdx, LogicEnd);
|
SkipRtlOffScreen(LogicIdx, LogicEnd);
|
||||||
//while FCurViewToken.Tk.TokenLength = 0 do
|
while FCurViewToken.Tk.TokenLength = 0 do
|
||||||
// if MaybeFetchToken then
|
if MaybeFetchToken then
|
||||||
// SkipRtlOffScreen(LogicIdx, LogicEnd);
|
SkipRtlOffScreen(LogicIdx, LogicEnd);
|
||||||
//MaybeChangeToLtr(LogicIdx, LogicEnd); // get NextTokenPhysStart
|
MaybeChangeToLtr(LogicIdx, LogicEnd); // get NextTokenPhysStart
|
||||||
|
|
||||||
ATokenInfo.NextPhysicalPaintStart := FCurViewToken.PhysicalPaintStart;
|
ATokenInfo.NextPhysicalPaintStart := FCurViewToken.PhysicalPaintStart;
|
||||||
ATokenInfo.NextLogicStart := FCurViewToken.LogicalStart;
|
ATokenInfo.NextLogicStart := FCurViewToken.LogicalStart;
|
||||||
|
Loading…
Reference in New Issue
Block a user