Synedit: Fixed insert space in new empty text, would cause exception

git-svn-id: trunk@19008 -
This commit is contained in:
martin 2009-03-16 20:26:21 +00:00
parent 8e7fc1ea58
commit 51d4db2ebc

View File

@ -742,8 +742,6 @@ end;
procedure TSynEditStringList.PutRange(Index: integer; ARange: TSynEditRange);
begin
if (Index < 0) or (Index >= Count) then
ListIndexOutOfBounds(Index);
{$IFDEF SYN_LAZARUS}
// do not call BeginUpdate/EndUpdate. It would call the too generic OnChange
// events
@ -759,18 +757,22 @@ function TSynEditStringList.GetAttribute(const Owner: TClass; const Index: Integ
var
i: Integer;
begin
if (Index = 0) and (Count = 0) then
exit(nil);
if (Index < 0) or (Index >= Count) then
ListIndexOutOfBounds(Index);
i := ClassIndexForAttribute(Owner);
if i < 0 then
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;
procedure TSynEditStringList.SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer);
var
i: Integer;
begin
if (Index = 0) and (Count = 0) then
Add('');
if (Index < 0) or (Index >= Count) then
ListIndexOutOfBounds(Index);
i := ClassIndexForAttribute(Owner);