diff --git a/components/synedit/synbeautifier.pas b/components/synedit/synbeautifier.pas index 906a70bdb3..e0e3688745 100644 --- a/components/synedit/synbeautifier.pas +++ b/components/synedit/synbeautifier.pas @@ -604,7 +604,7 @@ begin dec(BackCounter); Temp := GetLine(BackCounter); if Temp <> '' then begin - SetLength(Temp, GetIndentForLine(FCurrentEditor, Temp, False)); + Temp := copy(Temp, 1, GetIndentForLine(FCurrentEditor, Temp, False)); PhysLen := GetIndentForLine(FCurrentEditor, Temp, True); if (PhysLen > KnownPhysLen) and StartsStr(BasedMix, Temp) then begin @@ -714,7 +714,7 @@ begin // Temp := Lines[FoundLine-1] //else // FoundLine := BackCounter + 1; - SetLength(Temp, GetIndentForLine(Editor, Temp, False)); + Temp := copy(Temp, 1, GetIndentForLine(Editor, Temp, False)); case FIndentType of sbitCopySpaceTab: diff --git a/components/synedit/syneditmarkuphighall.pp b/components/synedit/syneditmarkuphighall.pp index 94740e04fa..1c552c1650 100644 --- a/components/synedit/syneditmarkuphighall.pp +++ b/components/synedit/syneditmarkuphighall.pp @@ -2713,7 +2713,7 @@ function TSynEditMarkupHighlightAllCaret.GetCurrentText: String; Result := copy(s, i, MaxInt); i := length(Result); while (i > 0) and (Result[i] in [#1..#32]) do dec(i); - SetLength(Result, i); + Result := copy(Result, 1, i); end; var LowBnd, UpBnd: TPoint; diff --git a/components/synedit/synedittexttrimmer.pas b/components/synedit/synedittexttrimmer.pas index 7381a47ca1..46986e5703 100644 --- a/components/synedit/synedittexttrimmer.pas +++ b/components/synedit/synedittexttrimmer.pas @@ -596,7 +596,7 @@ begin j := i - length(s) - 1; s := copy(FSpaces, j + 1, MaxInt); {$IFDEF SynTrimDebug}debugln(['--- Trimmer -- CaretChanged - Trimming,part to ',length(s),' ', ' fLineIndex=', fLineIndex, ' fSpaces=',length(fSpaces), 'newCaretYPos=',TSynEditCaret(Sender).LinePos]);{$ENDIF} - SetLength(FSpaces, j); + FSpaces := copy(FSpaces, 1, j); i := length(s); MaybeAddUndoForget(FLineIndex+1, s); SendNotification(senrLineChange, self, fLineIndex, 1); @@ -1000,7 +1000,7 @@ begin {$IFDEF SynTrimDebug}debugln(['--- Trimmer -- EditMoveToTrim()', ' fLineIndex=', fLineIndex, ' fSpaces=',length(fSpaces), ' Y=',LogY, ' len=',Len]);{$ENDIF} t := NextLines[LogY - 1]; s := copy(t, 1 + length(t) - Len, Len) + Spaces(LogY - 1); - SetLength(t, length(t) - Len); + t := copy(t, 1, length(t) - Len); StoreSpacesForLine(LogY - 1, s, t); NextLines[LogY - 1] := t; CurUndoList.AddChange(TSynEditUndoTrimMoveTo.Create(LogY, Len)); @@ -1118,7 +1118,7 @@ begin LenNS := LastNoneSpacePos(AText); if LenNS < Len then begin EditInsertTrim(1, LogY, copy(AText, 1 + LenNS, Len)); - SetLength(AText, LenNS); + AText := copy(AText, 1, LenNS); end; end; end; @@ -1276,7 +1276,7 @@ begin LenNS := LastNoneSpacePos(AText); if LenNS < Len then begin EditInsertTrim(1, LogY, copy(AText, 1 + LenNS, Len)); - SetLength(AText, LenNS); + AText := copy(AText, 1, LenNS); end; end; end; diff --git a/components/turbopower_ipro/ipcss.inc b/components/turbopower_ipro/ipcss.inc index 95852e7244..c5c4fdcd8f 100644 --- a/components/turbopower_ipro/ipcss.inc +++ b/components/turbopower_ipro/ipcss.inc @@ -513,7 +513,7 @@ end; function SizePxFromString(S: String): Integer; begin - SetLength(S, PosI('px',S)-1); + S := Copy(S, 1, PosI('px',S)-1); Result := StrToIntDef(S, 0); end;