SynEdit: Markup and more paint-token-breaker for future bidi support

git-svn-id: trunk@38979 -
This commit is contained in:
martin 2012-10-06 23:17:05 +00:00
parent 2146dc3628
commit d9957bbeea
11 changed files with 178 additions and 107 deletions

View File

@ -55,7 +55,7 @@ type
FCurViewRtlPhysEnd: integer;
FCurViewRtlLogEnd: integer;
FNextMarkupPhysPos: Integer;
FNextMarkupPhysPos, FNextMarkupLogPos: Integer;
FCurMarkupNextStart: TLazSynDisplayTokenBound;
FCurMarkupNextIsRtl: Boolean;
FCurMarkupEOL: Boolean;
@ -282,6 +282,7 @@ begin
FCurMarkupNextIsRtl := False;
end;
FNextMarkupPhysPos := -1;
FNextMarkupLogPos := -1;
FCurMarkupEOL := False;
FCurTxtLineIdx := ARealLine;
end;
@ -293,19 +294,24 @@ const
begin
if (FNextMarkupPhysPos < 0) or
(FCurMarkupNextIsRtl and (FNextMarkupPhysPos >= FCurMarkupNextStart.Physical)) or
((not FCurMarkupNextIsRtl) and (FNextMarkupPhysPos <= FCurMarkupNextStart.Physical))
((not FCurMarkupNextIsRtl) and (FNextMarkupPhysPos <= FCurMarkupNextStart.Physical)) or
(FNextMarkupLogPos < 0) or
(FCurMarkupNextIsRtl and (FNextMarkupLogPos >= FCurMarkupNextStart.Logical)) or
((not FCurMarkupNextIsRtl) and (FNextMarkupLogPos <= FCurMarkupNextStart.Logical))
then begin
FNextMarkupPhysPos := FMarkupManager.GetNextMarkupColAfterRowCol
(FCurTxtLineIdx+1, FCurMarkupNextStart, FCurMarkupNextIsRtl);
FMarkupManager.GetNextMarkupColAfterRowCol(FCurTxtLineIdx+1,
FCurMarkupNextStart, FCurMarkupNextIsRtl, FNextMarkupPhysPos, FNextMarkupLogPos);
if FNextMarkupPhysPos < 1 then
if FCurMarkupNextIsRtl
then FNextMarkupPhysPos := 1
else FNextMarkupPhysPos := MaxInt;
if FNextMarkupLogPos < 1 then
FNextMarkupLogPos := MaxInt;
end;
if FCurMarkupEOL
then Result := False
else Result := GetNextHighlighterTokenFromView(ATokenInfo, FNextMarkupPhysPos);
else Result := GetNextHighlighterTokenFromView(ATokenInfo, FNextMarkupPhysPos, FNextMarkupLogPos);
if (not Result) then begin
// the first run StartPos is set by GetNextHighlighterTokenFromView
@ -333,9 +339,19 @@ begin
else ATokenInfo.EndPos.Physical := FLastCol;
ATokenInfo.EndPos.Offset := 0;
ATokenInfo.EndPos.Logical := ATokenInfo.StartPos.Logical + (ATokenInfo.EndPos.Physical - ATokenInfo.StartPos.Physical);
if (FNextMarkupLogPos > 0) and (FNextMarkupLogPos < ATokenInfo.EndPos.Logical) then begin
ATokenInfo.EndPos.Physical := ATokenInfo.EndPos.Physical - (ATokenInfo.EndPos.Logical - FNextMarkupLogPos);
ATokenInfo.EndPos.Logical := FNextMarkupLogPos;
end;
assert(ATokenInfo.EndPos.Physical > ATokenInfo.StartPos.Physical, 'ATokenInfo.EndPos.Physical > ATokenInfo.StartPos.Physical');
assert(ATokenInfo.EndPos.Logical > ATokenInfo.StartPos.Logical, 'ATokenInfo.EndPos.Logical > ATokenInfo.StartPos.Logical');
FCurMarkupNextStart := ATokenInfo.EndPos;
if FCurMarkupNextIsRtl then
if FCurMarkupNextIsRtl then begin
FNextMarkupPhysPos := -1;
FNextMarkupLogPos := -1;
end;
FCurMarkupNextIsRtl := False;
ATokenInfo.PhysicalCharStart := ATokenInfo.StartPos.Physical;
@ -352,8 +368,10 @@ begin
//exit;
end
else begin
if ATokenInfo.NextIsRtl <> FCurMarkupNextIsRtl then
if ATokenInfo.NextIsRtl <> FCurMarkupNextIsRtl then begin
FNextMarkupPhysPos := -1;
FNextMarkupLogPos := -1;
end;
FCurMarkupNextStart := ATokenInfo.NextPos;
FCurMarkupNextIsRtl := ATokenInfo.NextIsRtl;

View File

@ -98,9 +98,10 @@ type
Function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean) : TSynSelectedColor; virtual; abstract;
Function GetNextMarkupColAfterRowCol(const aRow: Integer;
Procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean) : Integer; virtual; abstract;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); virtual; abstract;
procedure MergeMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol, AEndCol :TLazSynDisplayTokenBound;
const AnIsRTL: Boolean;
@ -161,9 +162,10 @@ type
Function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean) : TSynSelectedColor; override;
Function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean) : Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
procedure MergeMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol, AEndCol :TLazSynDisplayTokenBound;
const AnIsRTL: Boolean;
@ -533,18 +535,27 @@ begin
//MergeMarkupAttributeAtRowCol(aRow, aCol, GetNextMarkupColAfterRowCol(aRow, aCol) - 1, Result);
end;
function TSynEditMarkupManager.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean) : Integer;
procedure TSynEditMarkupManager.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
var
i, j : integer;
i, p, l : integer;
begin
ANextLog := -1;
ANextPhys := -1;
if fMarkUpList.Count = 0
then exit(-1);
Result := TSynEditMarkup(fMarkUpList[0]).GetNextMarkupColAfterRowCol(aRow, aStartCol, AnIsRTL);
then exit;
TSynEditMarkup(fMarkUpList[0]).GetNextMarkupColAfterRowCol(aRow, aStartCol, AnIsRTL, ANextPhys, ANextLog);
for i := 1 to fMarkUpList.Count-1 do begin
if not TSynEditMarkup(fMarkUpList[i]).Enabled then continue;
j := TSynEditMarkup(fMarkUpList[i]).GetNextMarkupColAfterRowCol(aRow, aStartCol, AnIsRTL);
if ((j>0) and (j < Result)) or (Result<0) then Result := j;
if not TSynEditMarkup(fMarkUpList[i]).Enabled then
continue;
TSynEditMarkup(fMarkUpList[i]).GetNextMarkupColAfterRowCol(aRow, aStartCol, AnIsRTL, p, l);
if AnIsRTL then begin
if ((p>0) and (p > ANextPhys)) or (ANextPhys<0) then ANextPhys := p;
end else begin
if ((p>0) and (p < ANextPhys)) or (ANextPhys<0) then ANextPhys := p;
end;
if ((l>0) and (l < ANextLog)) or (ANextLog<0) then ANextLog := l;
end;
end;

View File

@ -59,9 +59,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
procedure InvalidateBracketHighlight;
property HighlightStyle: TSynEditBracketHighlightStyle read FHighlightStyle write SetHighlightStyle;
@ -239,23 +240,25 @@ begin
end;
end;
function TSynEditMarkupBracket.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupBracket.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
begin
Result := -1;
ANextLog := -1;
ANextPhys := -1;
if (FBracketHighlightPos.y = aRow) then begin
if (FBracketHighlightPos.x > aStartCol.Physical )
then Result := FBracketHighlightPos.x
then ANextPhys := FBracketHighlightPos.x
else if (FBracketHighlightPos.x + 1 > aStartCol.Physical )
then Result := FBracketHighlightPos.x + 1; // end of bracket
then ANextPhys := FBracketHighlightPos.x + 1; // end of bracket
end;
if (FBracketHighlightAntiPos.y = aRow) then begin
if (FBracketHighlightAntiPos.x > aStartCol.Physical )
and ((FBracketHighlightAntiPos.x < Result) or (Result < 0))
then Result := FBracketHighlightAntiPos.x
and ((FBracketHighlightAntiPos.x < ANextPhys) or (ANextPhys < 0))
then ANextPhys := FBracketHighlightAntiPos.x
else if (FBracketHighlightAntiPos.x + 1 > aStartCol.Physical )
and ((FBracketHighlightAntiPos.x + 1 < Result) or (Result < 0))
then Result := FBracketHighlightAntiPos.x + 1;
and ((FBracketHighlightAntiPos.x + 1 < ANextPhys) or (ANextPhys < 0))
then ANextPhys := FBracketHighlightAntiPos.x + 1;
end
end;

View File

@ -63,9 +63,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
property CtrlMouseLine : Integer read FCtrlMouseLine write FCtrlMouseLine;
property CtrlMouseX1 : Integer read FCtrlMouseX1 write FCtrlMouseX1;
@ -253,17 +254,19 @@ begin
MarkupInfo.EndX := FCurX2;
end;
function TSynEditMarkupCtrlMouseLink.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupCtrlMouseLink.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
begin
Result := -1;
ANextLog := -1;
ANextPhys := -1;
if FCtrlMouseLine <> aRow
then exit;
if aStartCol.Physical < FCurX1
then Result := FCurX1;
then ANextPhys := FCurX1;
if (aStartCol.Physical < FCurX2) and (aStartCol.Physical >= FCurX1)
then Result := FCurX2;
then ANextPhys := FCurX2;
end;
end.

View File

@ -63,9 +63,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
end;
implementation
@ -144,19 +145,21 @@ begin
end;
end;
function TSynEditMarkupGutterMark.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupGutterMark.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
var
i: Integer;
begin
Result := -1;
ANextLog := -1;
ANextPhys := -1;
if length(FRowData) = 0 then
exit;
for i := 0 to length(FRowData) - 1 do begin
if FRowData[i].StartX < Result then
Result := FRowData[0].StartX;;
if FRowData[i].EndX < Result then
Result := FRowData[0].EndX;;
if FRowData[i].StartX < ANextPhys then
ANextPhys := FRowData[0].StartX;;
if FRowData[i].EndX < ANextPhys then
ANextPhys := FRowData[0].EndX;;
end;
end;

View File

@ -122,9 +122,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
Procedure Invalidate(RePaint: Boolean = True);
Procedure SendLineInvalidation;
@ -511,12 +512,14 @@ begin
result := MarkupInfo;
end;
function TSynEditMarkupHighlightAll.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupHighlightAll.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
var
Pos: Integer;
begin
result := -1;
ANextLog := -1;
ANextPhys := -1;
if (fSearchString = '') then
exit;
@ -536,8 +539,8 @@ begin
if fMatches.Point[Pos].y <> aRow
then exit;
Result := fMatches.Point[Pos].x;
//debugLN('--->NEXT POS ',dbgs(result),' / ',dbgs(ARow), ' at index ', dbgs(Pos));
ANextPhys := fMatches.Point[Pos].x;
//debugLN('--->NEXT POS ',dbgs(ANextPhys),' / ',dbgs(ARow), ' at index ', dbgs(Pos));
end;
{ TSynEditMarkupHighlightAllCaret }

View File

@ -50,9 +50,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
property UseIncrementalColor : Boolean read FUseIncrementalColor write SetUseIncrementalColor;
property MarkupInfoSeletion : TSynSelectedColor read FMarkupInfoSelection;
@ -145,14 +146,16 @@ begin
then Result := MarkupInfo;
end;
function TSynEditMarkupSelection.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupSelection.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
begin
result := -1;
ANextLog := -1;
ANextPhys := -1;
if (aStartCol.Physical < nSelStart)
then Result := nSelStart;
then ANextPhys := nSelStart;
if (aStartCol.Physical < nSelEnd) and (aStartCol.Physical >= nSelStart)
then result := nSelEnd;
then ANextPhys := nSelEnd;
end;
end.

View File

@ -51,9 +51,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
property VisibleSpecialChars: TSynVisibleSpecialChars read FVisibleSpecialChars write SetVisibleSpecialChars;
end;
@ -118,24 +119,32 @@ begin
end;
end;
function TSynEditMarkupSpecialChar.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupSpecialChar.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
var
s: Boolean;
i, LogCol: Integer;
begin
Result := -1;
ANextLog := -1;
ANextPhys := -1;
if (FCurLine='') or (not (FHasMarkup and (FVisibleSpecialChars <> []))) then exit;
if aStartCol.Physical < FCurStart then exit(FCurStart);
if aStartCol.Physical < FCurEnd then exit(FCurEnd);
if aStartCol.Physical < FCurStart then begin
ANextPhys := FCurStart;
exit;
end;
if aStartCol.Physical < FCurEnd then begin
ANextPhys := FCurEnd;
exit;
end;
LogCol := PhysicalToLogicalPos(Point(aStartCol.Physical, aRow)).x;
if LogCol > Length(FCurLine) then exit;
if (LogCol = Length(FCurLine)) then begin
if IsSpecial(LogCol) then
Result := LogicalToPhysicalPos(Point(Length(FCurLine)+1, aRow)).x;
FCurEnd := Result;
ANextPhys := LogicalToPhysicalPos(Point(Length(FCurLine)+1, aRow)).x;
FCurEnd := ANextPhys;
exit;
end;
@ -152,8 +161,14 @@ begin
while (i <= Length(FCurLine)) and (IsSpecial(i)) do inc(i);
FCurEnd := LogicalToPhysicalPos(Point(i, aRow)).x;
if aStartCol.Physical < FCurStart then exit(FCurStart);
if aStartCol.Physical < FCurEnd then exit(FCurEnd);
if aStartCol.Physical < FCurStart then begin
ANextPhys := FCurStart;
exit;
end;
if aStartCol.Physical < FCurEnd then begin
ANextPhys := FCurEnd;
exit;
end;
end;
end.

View File

@ -60,9 +60,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
procedure InvalidateLineHighlight;
@ -185,10 +186,12 @@ begin
Result := MarkupInfo;
end;
function TSynEditMarkupSpecialLine.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupSpecialLine.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
begin
Result := -1; // always valid for the whole line
ANextLog := -1;
ANextPhys := -1; // always valid for the whole line
end;
procedure TSynEditMarkupSpecialLine.InvalidateLineHighlight;

View File

@ -64,9 +64,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
property Highlighter: TSynCustomHighlighter
read FHighlighter write SetHighlighter;
@ -420,26 +421,28 @@ begin
end;
end;
function TSynEditMarkupWordGroup.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynEditMarkupWordGroup.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
Procedure CheckCol(Column: Integer; var Result: Integer);
begin
if (Column <= aStartCol.Physical) or ((Result >= 0) and (Result < Column)) then exit;
Result := Column;
end;
begin
Result := -1;
ANextLog := -1;
ANextPhys := -1;
if (FHighlightPos1.y = aRow) then begin
CheckCol(FHighlightPos1.X, Result);
CheckCol(FHighlightPos1.X2, Result);
CheckCol(FHighlightPos1.X, ANextPhys);
CheckCol(FHighlightPos1.X2, ANextPhys);
end;
if (FHighlightPos3.y = aRow) then begin
CheckCol(FHighlightPos3.X, Result);
CheckCol(FHighlightPos3.X2, Result);
CheckCol(FHighlightPos3.X, ANextPhys);
CheckCol(FHighlightPos3.X2, ANextPhys);
end;
if (FHighlightPos2.y = aRow) then begin
CheckCol(FHighlightPos2.X, Result);
CheckCol(FHighlightPos2.X2, Result);
CheckCol(FHighlightPos2.X, ANextPhys);
CheckCol(FHighlightPos2.X2, ANextPhys);
end;
end;

View File

@ -118,9 +118,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
Procedure PrepareMarkupForRow(aRow : Integer); override;
Procedure EndMarkup; override;
@ -139,9 +140,10 @@ type
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): TSynSelectedColor; override;
function GetNextMarkupColAfterRowCol(const aRow: Integer;
procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const AnIsRTL: Boolean): Integer; override;
const AnIsRTL: Boolean;
out ANextPhys, ANextLog: Integer); override;
property CellGroupForArea: Integer read FCellIdForArea write FCellIdForArea;
end;
@ -558,26 +560,28 @@ begin
end;
end;
function TSynPluginSyncronizedEditMarkup.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynPluginSyncronizedEditMarkup.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
var
i, col: Integer;
begin
col := PhysicalToLogicalPos(Point(aStartCol.Physical, aRow)).x;
Result := -1;
ANextLog := -1;
ANextPhys := -1;
for i := FPreparedCellFrom to FPreparedCellTo do begin
if Cells[i].Group < 0 then continue;
if (Cells[i].LogStart.y = aRow) and (Cells[i].LogStart.x > Col) and
( (Cells[i].LogStart.x < Result) or (Result < 0) )
( (Cells[i].LogStart.x < ANextPhys) or (ANextPhys < 0) )
then
Result := Cells[i].LogStart.x;
ANextPhys := Cells[i].LogStart.x;
if (Cells[i].LogEnd.y = aRow) and (Cells[i].LogEnd.x > Col) and
( (Cells[i].LogEnd.x < Result) or (Result < 0) )
( (Cells[i].LogEnd.x < ANextPhys) or (ANextPhys < 0) )
then
Result := Cells[i].LogEnd.x;
ANextPhys := Cells[i].LogEnd.x;
end;
if Result >= 0 then
Result := LogicalToPhysicalPos(Point(Result, aRow)).x;
if ANextPhys >= 0 then
ANextPhys := LogicalToPhysicalPos(Point(ANextPhys, aRow)).x;
end;
procedure TSynPluginSyncronizedEditMarkup.PrepareMarkupForRow(aRow: Integer);
@ -647,23 +651,25 @@ begin
end;
end;
function TSynPluginSyncronizedEditMarkupArea.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean): Integer;
procedure TSynPluginSyncronizedEditMarkupArea.GetNextMarkupColAfterRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound; const AnIsRTL: Boolean; out ANextPhys,
ANextLog: Integer);
var
ac: TSynPluginSyncronizedEditCell;
begin
Result := -1;
ANextLog := -1;
ANextPhys := -1;
if MarkupInfo.IsEnabled then begin
ac := Cells.GroupCell[CellGroupForArea, 0];
if ac <> nil then begin
if (ac.LogStart.y = aRow) and (ac.LogStart.x > aStartCol.Physical) and
( (ac.LogStart.x < Result) or (Result < 0) )
( (ac.LogStart.x < ANextPhys) or (ANextPhys < 0) )
then
Result := ac.LogStart.x;
ANextPhys := ac.LogStart.x;
if (ac.LogEnd.y = aRow) and (ac.LogEnd.x > aStartCol.Physical) and
( (ac.LogEnd.x < Result) or (Result < 0) )
( (ac.LogEnd.x < ANextPhys) or (ANextPhys < 0) )
then
Result := ac.LogEnd.x;
ANextPhys := ac.LogEnd.x;
end;
end;
end;