mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 19:39:17 +02:00
Synedit: Fixed insert space in new empty text, would cause exception
git-svn-id: trunk@19008 -
This commit is contained in:
parent
8e7fc1ea58
commit
51d4db2ebc
@ -742,8 +742,6 @@ end;
|
|||||||
|
|
||||||
procedure TSynEditStringList.PutRange(Index: integer; ARange: TSynEditRange);
|
procedure TSynEditStringList.PutRange(Index: integer; ARange: TSynEditRange);
|
||||||
begin
|
begin
|
||||||
if (Index < 0) or (Index >= Count) then
|
|
||||||
ListIndexOutOfBounds(Index);
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
// do not call BeginUpdate/EndUpdate. It would call the too generic OnChange
|
// do not call BeginUpdate/EndUpdate. It would call the too generic OnChange
|
||||||
// events
|
// events
|
||||||
@ -759,18 +757,22 @@ function TSynEditStringList.GetAttribute(const Owner: TClass; const Index: Integ
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
if (Index = 0) and (Count = 0) then
|
||||||
|
exit(nil);
|
||||||
if (Index < 0) or (Index >= Count) then
|
if (Index < 0) or (Index >= Count) then
|
||||||
ListIndexOutOfBounds(Index);
|
ListIndexOutOfBounds(Index);
|
||||||
i := ClassIndexForAttribute(Owner);
|
i := ClassIndexForAttribute(Owner);
|
||||||
if i < 0 then
|
if i < 0 then
|
||||||
raise ESynEditStringList.CreateFmt('Unknown Attribute', []);
|
raise ESynEditStringList.CreateFmt('Unknown Attribute', []);
|
||||||
Result := FList.Attribute[Index, FAttributeList[i].Pos, FAttributeList[i].Size];
|
Result := FList.Attribute[Index, FAttributeList[i].Pos, FAttributeList[i].Size]
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringList.SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer);
|
procedure TSynEditStringList.SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
if (Index = 0) and (Count = 0) then
|
||||||
|
Add('');
|
||||||
if (Index < 0) or (Index >= Count) then
|
if (Index < 0) or (Index >= Count) then
|
||||||
ListIndexOutOfBounds(Index);
|
ListIndexOutOfBounds(Index);
|
||||||
i := ClassIndexForAttribute(Owner);
|
i := ClassIndexForAttribute(Owner);
|
||||||
|
Loading…
Reference in New Issue
Block a user