mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 16:19:36 +02:00
SynEdit: Undo initializations, if value is either not needed or always set.
git-svn-id: trunk@48497 -
This commit is contained in:
parent
7b6b5c3ce1
commit
a2ec42e01e
@ -869,7 +869,6 @@ begin
|
||||
{$ENDIF}
|
||||
PrepareWidthsForLine(AIndex);
|
||||
|
||||
Result := 0;
|
||||
dec(ABytePos);
|
||||
if ABytePos < FCurrentWidthsLen then begin
|
||||
if (FCurrentWidths[ABytePos] and PCWMask) = 0 then begin
|
||||
|
@ -1551,6 +1551,7 @@ var
|
||||
LineBufferLen := Len + ATokenInfo.ExpandedExtraBytes + 1 + 128;
|
||||
ReAllocMem(LineBuffer, LineBufferLen);
|
||||
end;
|
||||
pl := LineBuffer;
|
||||
end;
|
||||
|
||||
// Prepare FETOBuf
|
||||
@ -1563,9 +1564,8 @@ var
|
||||
end
|
||||
else
|
||||
c := 0;
|
||||
e := 0;
|
||||
|
||||
pl := LineBuffer;
|
||||
e := 0;
|
||||
CWLen := Length(CharWidths);
|
||||
|
||||
// Copy to LineBuffer (and maybe FetoBuf
|
||||
|
@ -805,7 +805,6 @@ end;
|
||||
|
||||
function TSynBeautifierPascal.GetMatchStartColForIdx(AIndex: Integer): Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
if ToPos(AIndex) = GetFirstCommentLine then begin
|
||||
// Match on FirstLine
|
||||
case FMatchMode[FWorkFoldType] of
|
||||
@ -1749,7 +1748,6 @@ var
|
||||
FoundLine: LongInt;
|
||||
begin
|
||||
Result := 1;
|
||||
Temp := '';
|
||||
FCurrentLines := Lines; // for GetCurrentIndent
|
||||
BackCounter := ACaret.LinePos - 1;
|
||||
if BackCounter > 0 then
|
||||
|
@ -1895,9 +1895,7 @@ begin
|
||||
if eoFoldedCopyPaste in fOptions2 then
|
||||
FInfo := FFoldedLinesView.GetFoldDescription(
|
||||
FBlockSelection.FirstLineBytePos.Y - 1, FBlockSelection.FirstLineBytePos.X,
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X)
|
||||
else
|
||||
FInfo := '';
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X);
|
||||
DoCopyToClipboard(SelText, FInfo);
|
||||
end;
|
||||
end;
|
||||
@ -1910,9 +1908,7 @@ begin
|
||||
if eoFoldedCopyPaste in fOptions2 then
|
||||
FInfo := FFoldedLinesView.GetFoldDescription(
|
||||
FBlockSelection.FirstLineBytePos.Y - 1, FBlockSelection.FirstLineBytePos.X,
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X)
|
||||
else
|
||||
FInfo := '';
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X);
|
||||
DoCopyToClipboard(SelText, FInfo);
|
||||
SetSelTextExternal('');
|
||||
end;
|
||||
|
@ -1038,9 +1038,7 @@ begin
|
||||
CharWidthsArr := FLines.GetPhysicalCharWidths(Pchar(L), length(L), FLinePos-1);
|
||||
LogLen := Length(CharWidthsArr);
|
||||
if LogLen > 0 then
|
||||
CharWidths := @CharWidthsArr[0]
|
||||
else
|
||||
CharWidths := nil;
|
||||
CharWidths := @CharWidthsArr[0];
|
||||
end;
|
||||
|
||||
ScreenPos := 1;
|
||||
@ -1524,7 +1522,8 @@ function TSynEditSelection.GetSelText : string;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CopyAndForward(const S: string; Index, Count: Integer; var P: PChar);
|
||||
procedure CopyAndForward(const S: string; Index, Count: Integer; var P:
|
||||
PChar);
|
||||
var
|
||||
pSrc: PChar;
|
||||
SrcLen: Integer;
|
||||
@ -1541,7 +1540,8 @@ function TSynEditSelection.GetSelText : string;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CopyPaddedAndForward(const S: string; Index, Count: Integer; var P: PChar);
|
||||
procedure CopyPaddedAndForward(const S: string; Index, Count: Integer;
|
||||
var P: PChar);
|
||||
var
|
||||
OldP: PChar;
|
||||
Len: Integer;
|
||||
@ -1563,9 +1563,9 @@ var
|
||||
Col, Len: array of Integer;
|
||||
|
||||
begin
|
||||
Result := '';
|
||||
if SelAvail then
|
||||
begin
|
||||
if not SelAvail then
|
||||
Result := ''
|
||||
else begin
|
||||
if IsBackwardSel then begin
|
||||
ColFrom := FEndBytePos;
|
||||
First := FEndLinePos - 1;
|
||||
@ -2009,7 +2009,6 @@ var
|
||||
begin
|
||||
// Insert string at current position
|
||||
Result := 0;
|
||||
Str := '';
|
||||
Start := PChar(Value);
|
||||
repeat
|
||||
P := GetEOL(Start);
|
||||
@ -3003,7 +3002,7 @@ begin
|
||||
if (not FCanPaint) and FIsDrawn then begin
|
||||
AddAfterPaint([psCleanOld, psRemoveTimer]);
|
||||
FIsDrawn := False;
|
||||
exit(False);
|
||||
exit(True);
|
||||
end;
|
||||
|
||||
FOwner.PaintTimer.RemoveHandler(@DoTimer);
|
||||
@ -3014,7 +3013,7 @@ end;
|
||||
|
||||
function TSynEditScreenCaretPainterInternal.ShowCaret: Boolean;
|
||||
begin
|
||||
if Showing then exit(False);
|
||||
if Showing then exit(True);
|
||||
inherited ShowCaret;
|
||||
Exclude(FState, psRemoveTimer);
|
||||
// Exclude(FState, psCleanOld); // only if not moved
|
||||
|
@ -227,7 +227,6 @@ end;
|
||||
|
||||
function TSynGutter.CreatePartList: TSynGutterPartListBase;
|
||||
begin
|
||||
Result := nil;
|
||||
case Side of
|
||||
gsLeft:
|
||||
begin
|
||||
|
@ -494,15 +494,13 @@ var
|
||||
begin
|
||||
AliasMode := Canvas.AntialiasingMode;
|
||||
Canvas.AntialiasingMode:=amOff;
|
||||
OdlCosmetic := False;
|
||||
OdlCosmetic := Canvas.Pen.Cosmetic;
|
||||
if nsoLostHl in SubType then begin
|
||||
Canvas.Pen.Style := psDot;
|
||||
OdlCosmetic := Canvas.Pen.Cosmetic;
|
||||
Canvas.Pen.Cosmetic := False;
|
||||
end;
|
||||
if nsoBlockSel in SubType then begin
|
||||
Canvas.Pen.Style := psDash;
|
||||
OdlCosmetic := Canvas.Pen.Cosmetic;
|
||||
Canvas.Pen.Cosmetic := False;
|
||||
end;
|
||||
Canvas.Rectangle(Rect);
|
||||
|
@ -1169,7 +1169,6 @@ begin
|
||||
else begin
|
||||
// Find new start of a Scheme
|
||||
NewSearchPos := -1;
|
||||
j := 0;
|
||||
for i := 0 to Schemes.Count - 1 do begin
|
||||
TmpSearchPos := Schemes.Items[i].FindStartPosInLine(SearchPos);
|
||||
if (NewSearchPos < 0) or ((TmpSearchPos > 0) and (TmpSearchPos < NewSearchPos)) then begin
|
||||
|
@ -3287,13 +3287,7 @@ begin
|
||||
exit;
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_REGION, FOLDGROUP_IFDEF] then
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex]
|
||||
else begin
|
||||
inf.EndLevelIfDef := 0;
|
||||
inf.MinLevelIfDef := 0;
|
||||
inf.EndLevelRegion := 0;
|
||||
inf.MinLevelRegion := 0;
|
||||
end;
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex];
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_PASCAL] then begin
|
||||
// All or Pascal
|
||||
@ -3343,13 +3337,7 @@ begin
|
||||
exit;
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_REGION, FOLDGROUP_IFDEF] then
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex]
|
||||
else begin
|
||||
inf.EndLevelIfDef := 0;
|
||||
inf.MinLevelIfDef := 0;
|
||||
inf.EndLevelRegion := 0;
|
||||
inf.MinLevelRegion := 0;
|
||||
end;
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex];
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_PASCAL] then begin
|
||||
// All or Pascal
|
||||
@ -3860,9 +3848,7 @@ var
|
||||
nd: PSynFoldNodeInfo;
|
||||
begin
|
||||
if FCatchNodeInfo then
|
||||
i := FCatchNodeInfoList.CountAll
|
||||
else
|
||||
i := 0;
|
||||
i := FCatchNodeInfoList.CountAll;
|
||||
EndPascalCodeFoldBlock;
|
||||
if FAtLineStart then begin
|
||||
// If we are not at linestart, new folds could have been opened => handle as normal close
|
||||
|
@ -1582,9 +1582,7 @@ begin
|
||||
if (y1 < 0) or (y1 > Editor.LinesInWindow + 1) then
|
||||
y := -1; // not visible
|
||||
if y > 1 then
|
||||
y2 := Editor.RowToScreenRow(y-1)
|
||||
else
|
||||
y2 := 0;
|
||||
y2 := Editor.RowToScreenRow(y-1);
|
||||
|
||||
if (y > 0) and (y1 <> y2) or (y=1) then begin
|
||||
if Carets.Visual[Result] = nil then
|
||||
@ -1635,9 +1633,7 @@ begin
|
||||
end;
|
||||
|
||||
if y > 1 then
|
||||
y2 := Editor.RowToScreenRow(y-1)
|
||||
else
|
||||
y2 := 0;
|
||||
y2 := Editor.RowToScreenRow(y-1);
|
||||
|
||||
if (y1 <> y2) or (y=1) then begin
|
||||
if Carets.Visual[i] = nil then
|
||||
|
Loading…
Reference in New Issue
Block a user