SynEdit: fixed syncro edit cell order (added by IDE for templates). Issue #40866

This commit is contained in:
Martin 2024-04-06 20:02:39 +02:00
parent c280b11889
commit a8f03a8829

View File

@ -68,7 +68,7 @@ type
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear;
function Add(aCell: TSynPluginSyncronizedEditCell): Integer; function Add(aCell: TSynPluginSyncronizedEditCell; AnAddSorted: Boolean = False): Integer;
function AddNew: TSynPluginSyncronizedEditCell; virtual; // only add sorted function AddNew: TSynPluginSyncronizedEditCell; virtual; // only add sorted
procedure Delete(aIndex: Integer); procedure Delete(aIndex: Integer);
function IndexOf(aCell: TSynPluginSyncronizedEditCell): Integer; function IndexOf(aCell: TSynPluginSyncronizedEditCell): Integer;
@ -443,13 +443,13 @@ begin
FOnCellChange(aIndex, OldVal, AValue); FOnCellChange(aIndex, OldVal, AValue);
end; end;
function TSynPluginSyncronizedEditList.Add(aCell: TSynPluginSyncronizedEditCell): Integer; function TSynPluginSyncronizedEditList.Add(aCell: TSynPluginSyncronizedEditCell;
AnAddSorted: Boolean): Integer;
var var
i, n: Integer; i, n: Integer;
begin begin
if aCell.LogStart.Y = High(Integer) then n := -1;
n := -1 if AnAddSorted then
else
n := IndexOfNext(aCell.LogStart.x, aCell.LogStart.Y); n := IndexOfNext(aCell.LogStart.x, aCell.LogStart.Y);
i := length(FCells); i := length(FCells);
@ -467,7 +467,6 @@ end;
function TSynPluginSyncronizedEditList.AddNew: TSynPluginSyncronizedEditCell; function TSynPluginSyncronizedEditList.AddNew: TSynPluginSyncronizedEditCell;
begin begin
Result := TSynPluginSyncronizedEditCell.Create; Result := TSynPluginSyncronizedEditCell.Create;
Result.FLogStart.y := high(Integer);
Add(Result); Add(Result);
end; end;
@ -1950,7 +1949,7 @@ var
nc.LogEnd := p2; nc.LogEnd := p2;
nc.Group := Grp; nc.Group := Grp;
nc.FirstInGroup := AsFirst; nc.FirstInGroup := AsFirst;
Cells.Add(nc); Cells.Add(nc, True);
end; end;
var var
BndCell: TSynPluginSyncronizedEditCell; BndCell: TSynPluginSyncronizedEditCell;