mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-26 00:02:36 +02:00
SynEdit: Initialize variables based on compiler warnings. Contains ToDo items.
git-svn-id: trunk@48478 -
This commit is contained in:
parent
c666926244
commit
4e16799fd7
@ -869,6 +869,7 @@ begin
|
||||
{$ENDIF}
|
||||
PrepareWidthsForLine(AIndex);
|
||||
|
||||
Result := 0;
|
||||
dec(ABytePos);
|
||||
if ABytePos < FCurrentWidthsLen then begin
|
||||
if (FCurrentWidths[ABytePos] and PCWMask) = 0 then begin
|
||||
|
@ -738,7 +738,7 @@ begin
|
||||
{$IFDEF WinIMEDebug}
|
||||
DebugLn(['--- GCS_CURSORPOS ', dbgs(ImeCount)]);
|
||||
{$ENDIF}
|
||||
if ImeCount >= 0 then begin
|
||||
if ImeCount >= 0 then begin // ToDo: Comparison is always True.
|
||||
ImeCount := ImeCount and $ffff;
|
||||
x := FImeBlockSelection.StartBytePos;
|
||||
x := x + CharToByte(x, ImeCount);
|
||||
|
@ -1551,7 +1551,6 @@ var
|
||||
LineBufferLen := Len + ATokenInfo.ExpandedExtraBytes + 1 + 128;
|
||||
ReAllocMem(LineBuffer, LineBufferLen);
|
||||
end;
|
||||
pl := LineBuffer;
|
||||
end;
|
||||
|
||||
// Prepare FETOBuf
|
||||
@ -1561,9 +1560,12 @@ var
|
||||
FEtoBuf := FTextDrawer.Eto;
|
||||
FEtoBuf.SetMinLength(Len + ATokenInfo.ExpandedExtraBytes + 1);
|
||||
c := FTextDrawer.GetCharWidth;
|
||||
e := 0;
|
||||
end;
|
||||
end
|
||||
else
|
||||
c := 0;
|
||||
|
||||
pl := LineBuffer;
|
||||
e := 0;
|
||||
CWLen := Length(CharWidths);
|
||||
|
||||
// Copy to LineBuffer (and maybe FetoBuf
|
||||
|
@ -805,6 +805,7 @@ end;
|
||||
|
||||
function TSynBeautifierPascal.GetMatchStartColForIdx(AIndex: Integer): Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
if ToPos(AIndex) = GetFirstCommentLine then begin
|
||||
// Match on FirstLine
|
||||
case FMatchMode[FWorkFoldType] of
|
||||
@ -1748,6 +1749,7 @@ var
|
||||
FoundLine: LongInt;
|
||||
begin
|
||||
Result := 1;
|
||||
Temp := '';
|
||||
FCurrentLines := Lines; // for GetCurrentIndent
|
||||
BackCounter := ACaret.LinePos - 1;
|
||||
if BackCounter > 0 then
|
||||
|
@ -1895,7 +1895,9 @@ begin
|
||||
if eoFoldedCopyPaste in fOptions2 then
|
||||
FInfo := FFoldedLinesView.GetFoldDescription(
|
||||
FBlockSelection.FirstLineBytePos.Y - 1, FBlockSelection.FirstLineBytePos.X,
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X);
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X)
|
||||
else
|
||||
FInfo := '';
|
||||
DoCopyToClipboard(SelText, FInfo);
|
||||
end;
|
||||
end;
|
||||
@ -1908,7 +1910,9 @@ begin
|
||||
if eoFoldedCopyPaste in fOptions2 then
|
||||
FInfo := FFoldedLinesView.GetFoldDescription(
|
||||
FBlockSelection.FirstLineBytePos.Y - 1, FBlockSelection.FirstLineBytePos.X,
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X);
|
||||
FBlockSelection.LastLineBytePos.Y - 1, FBlockSelection.LastLineBytePos.X)
|
||||
else
|
||||
FInfo := '';
|
||||
DoCopyToClipboard(SelText, FInfo);
|
||||
SetSelTextExternal('');
|
||||
end;
|
||||
|
@ -2680,6 +2680,7 @@ begin
|
||||
if not OnlyNested then
|
||||
RemoveNode(ANode.fData);
|
||||
|
||||
NestedLine := 0;
|
||||
If ANode.fData.Nested <> nil then
|
||||
begin
|
||||
(*Todo: should we mark the tree as NO balancing needed ???*)
|
||||
@ -4923,6 +4924,7 @@ var
|
||||
EndLvl, CurLvl: Array of integer;
|
||||
i, c, t, n, o: Integer;
|
||||
nd: TSynFoldNodeInfo;
|
||||
|
||||
procedure GetEndLvl(l: Integer);
|
||||
var i: integer;
|
||||
begin
|
||||
@ -4939,11 +4941,18 @@ var
|
||||
CurLvl[0] := EndLvl[0];
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
hl := TSynCustomFoldHighlighter(HighLighter);
|
||||
if not assigned(hl) then
|
||||
exit;
|
||||
exit; // ToDo: Initialize Result
|
||||
|
||||
nd.LogXStart := 0;
|
||||
nd.LogXEnd := 0;
|
||||
nd.FoldAction := [];
|
||||
nd.FoldType := Nil;
|
||||
nd.FoldGroup := 0;
|
||||
n := 0;
|
||||
if AType <> 0 then
|
||||
TypeCnt := 1
|
||||
else
|
||||
|
@ -826,7 +826,7 @@ end;
|
||||
function TSynEditMarkLineList.RemoveMark(Item: TSynEditMark): Integer;
|
||||
begin
|
||||
if Item.MarkLine = nil then
|
||||
exit;
|
||||
exit(-1);
|
||||
Result := Item.MarkLine.GetSizesBeforeSum;
|
||||
Result := Result + Item.MarkLine.Remove(Item);
|
||||
end;
|
||||
|
@ -1370,6 +1370,8 @@ var
|
||||
o: TSynSearchTerm;
|
||||
MatchBegin: PChar;
|
||||
begin
|
||||
Len := 0;
|
||||
MatchBegin := nil;
|
||||
while MatchIdx >= 0 do begin
|
||||
o := FTermDict[MatchIdx];
|
||||
|
||||
|
@ -433,6 +433,7 @@ var
|
||||
cCol: integer;
|
||||
iIdentChars: TSynIdentChars;
|
||||
begin
|
||||
Result := '';
|
||||
iString := CurrentEditor.LineText;
|
||||
if (CurrentEditor.CaretX > 1) and
|
||||
(CurrentEditor.CaretX -1 <= Length(iString)) then
|
||||
|
@ -1038,7 +1038,9 @@ begin
|
||||
CharWidthsArr := FLines.GetPhysicalCharWidths(Pchar(L), length(L), FLinePos-1);
|
||||
LogLen := Length(CharWidthsArr);
|
||||
if LogLen > 0 then
|
||||
CharWidths := @CharWidthsArr[0];
|
||||
CharWidths := @CharWidthsArr[0]
|
||||
else
|
||||
CharWidths := nil;
|
||||
end;
|
||||
|
||||
ScreenPos := 1;
|
||||
@ -1522,8 +1524,7 @@ 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;
|
||||
@ -1540,8 +1541,7 @@ 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
|
||||
if not SelAvail then
|
||||
Result := ''
|
||||
else begin
|
||||
Result := '';
|
||||
if SelAvail then
|
||||
begin
|
||||
if IsBackwardSel then begin
|
||||
ColFrom := FEndBytePos;
|
||||
First := FEndLinePos - 1;
|
||||
@ -2009,6 +2009,7 @@ var
|
||||
begin
|
||||
// Insert string at current position
|
||||
Result := 0;
|
||||
Str := '';
|
||||
Start := PChar(Value);
|
||||
repeat
|
||||
P := GetEOL(Start);
|
||||
@ -2701,7 +2702,9 @@ function TSynEditScreenCaretPainterSystem.HideCaret: Boolean;
|
||||
begin
|
||||
inherited HideCaret;
|
||||
if HandleAllocated then
|
||||
Result := LCLIntf.HideCaret(Handle);
|
||||
Result := LCLIntf.HideCaret(Handle)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TSynEditScreenCaretPainterSystem.ShowCaret: Boolean;
|
||||
@ -3000,7 +3003,7 @@ begin
|
||||
if (not FCanPaint) and FIsDrawn then begin
|
||||
AddAfterPaint([psCleanOld, psRemoveTimer]);
|
||||
FIsDrawn := False;
|
||||
exit;
|
||||
exit(False);
|
||||
end;
|
||||
|
||||
FOwner.PaintTimer.RemoveHandler(@DoTimer);
|
||||
@ -3011,7 +3014,7 @@ end;
|
||||
|
||||
function TSynEditScreenCaretPainterInternal.ShowCaret: Boolean;
|
||||
begin
|
||||
if Showing then exit;
|
||||
if Showing then exit(False);
|
||||
inherited ShowCaret;
|
||||
Exclude(FState, psRemoveTimer);
|
||||
// Exclude(FState, psCleanOld); // only if not moved
|
||||
|
@ -1275,6 +1275,7 @@ function TSynEditStringList.EditDelete(LogX, LogY, ByteLen: Integer): String;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
Result := '';
|
||||
if ByteLen <= 0 then
|
||||
exit;
|
||||
IncIsInEditAction;
|
||||
@ -1440,6 +1441,7 @@ begin
|
||||
FModifiedNotifyOldCount := FModifiedNotifyOldCount + i;
|
||||
end;
|
||||
|
||||
oldcount := 0;
|
||||
if AReason = senrLineCount then begin
|
||||
if aCount < 0 then begin
|
||||
oldcount := -aCount;
|
||||
|
@ -1125,6 +1125,7 @@ var
|
||||
Len: Integer;
|
||||
SaveByteLen: LongInt;
|
||||
begin
|
||||
Result := '';
|
||||
if (not fEnabled) or (ByteLen <= 0) then begin
|
||||
fSynStrings.EditDelete(LogX, LogY, ByteLen);
|
||||
exit;
|
||||
@ -1140,7 +1141,6 @@ begin
|
||||
IncIsInEditAction;
|
||||
FlushNotificationCache;
|
||||
SaveByteLen := ByteLen;
|
||||
Result := '';
|
||||
|
||||
IgnoreSendNotification(senrEditAction, True);
|
||||
// Delete uncommited spaces (could also be ByteLen too big, due to past EOL)
|
||||
|
@ -227,6 +227,7 @@ end;
|
||||
|
||||
function TSynGutter.CreatePartList: TSynGutterPartListBase;
|
||||
begin
|
||||
Result := nil;
|
||||
case Side of
|
||||
gsLeft:
|
||||
begin
|
||||
@ -312,7 +313,9 @@ var
|
||||
begin
|
||||
MouseDownPart := PixelToPartIndex(AnInfo.MouseX);
|
||||
if MouseDownPart < PartCount then
|
||||
Result := Parts[MouseDownPart].MaybeHandleMouseAction(AnInfo, HandleActionProc);
|
||||
Result := Parts[MouseDownPart].MaybeHandleMouseAction(AnInfo, HandleActionProc)
|
||||
else
|
||||
Result := False;
|
||||
if not Result then
|
||||
Result := inherited MaybeHandleMouseAction(AnInfo, HandleActionProc);
|
||||
end;
|
||||
|
@ -494,6 +494,7 @@ var
|
||||
begin
|
||||
AliasMode := Canvas.AntialiasingMode;
|
||||
Canvas.AntialiasingMode:=amOff;
|
||||
OdlCosmetic := False;
|
||||
if nsoLostHl in SubType then begin
|
||||
Canvas.Pen.Style := psDot;
|
||||
OdlCosmetic := Canvas.Pen.Cosmetic;
|
||||
|
@ -740,7 +740,9 @@ begin
|
||||
Insert(i, LMarks);
|
||||
end;
|
||||
if i >= 0 then
|
||||
Result := Items[i];
|
||||
Result := Items[i]
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TSynGutterLOvLineMarksList.SetItemHeight(const AValue: Integer);
|
||||
|
@ -2769,7 +2769,7 @@ end;
|
||||
function TSynHTMLSyn.StartHtmlNodeCodeFoldBlock(ABlockType: THtmlCodeFoldBlockType;
|
||||
OpenPos: Integer; AName: String): TSynCustomCodeFoldBlock;
|
||||
begin
|
||||
if not FFoldConfig[ord(cfbtHtmlNode)].Enabled then exit;
|
||||
if not FFoldConfig[ord(cfbtHtmlNode)].Enabled then exit(nil);
|
||||
Result := inherited StartXmlNodeCodeFoldBlock(ord(ABlockType), OpenPos, AName);
|
||||
end;
|
||||
|
||||
|
@ -713,7 +713,9 @@ begin
|
||||
NewVLine := NewVLine + s.EndPos.y - s.StartPos.y;
|
||||
LastEnd := s.EndPos.y;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
LastVline := 0; // ToDo: Initialize LastVline properly.
|
||||
if VDiff = 0 then
|
||||
VDiff := Count - FRScanStartedWithLineCount;
|
||||
if VDiff < 0 then begin
|
||||
@ -1141,7 +1143,9 @@ begin
|
||||
CurRegStart.y := 0;
|
||||
CurRegStart.x := 1;
|
||||
CurRegTokenPos := 1;
|
||||
end;
|
||||
end
|
||||
else
|
||||
CurRegTokenPos := 0;
|
||||
StartAtLineIndex(Result); // Set FCurScheme
|
||||
|
||||
dec(Result);
|
||||
@ -1165,6 +1169,7 @@ 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,7 +3287,13 @@ begin
|
||||
exit;
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_REGION, FOLDGROUP_IFDEF] then
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex];
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex]
|
||||
else begin
|
||||
inf.EndLevelIfDef := 0;
|
||||
inf.MinLevelIfDef := 0;
|
||||
inf.EndLevelRegion := 0;
|
||||
inf.MinLevelRegion := 0;
|
||||
end;
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_PASCAL] then begin
|
||||
// All or Pascal
|
||||
@ -3337,7 +3343,13 @@ begin
|
||||
exit;
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_REGION, FOLDGROUP_IFDEF] then
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex];
|
||||
inf := TSynHighlighterPasRangeList(CurrentRanges).PasRangeInfo[ALineIndex]
|
||||
else begin
|
||||
inf.EndLevelIfDef := 0;
|
||||
inf.MinLevelIfDef := 0;
|
||||
inf.EndLevelRegion := 0;
|
||||
inf.MinLevelRegion := 0;
|
||||
end;
|
||||
|
||||
if AFilter.FoldGroup in [0, FOLDGROUP_PASCAL] then begin
|
||||
// All or Pascal
|
||||
@ -3761,7 +3773,7 @@ var
|
||||
begin
|
||||
BlockEnabled := FFoldConfig[ord(ABlockType)].Enabled;
|
||||
if (not BlockEnabled) and OnlyEnabled then
|
||||
exit;
|
||||
exit(nil);
|
||||
FoldBlock := BlockEnabled and (FFoldConfig[ord(ABlockType)].Modes * [fmFold, fmHide] <> []);
|
||||
p := 0;
|
||||
if FCatchNodeInfo then begin // exclude subblocks, because they do not increase the foldlevel yet
|
||||
@ -3848,7 +3860,9 @@ var
|
||||
nd: PSynFoldNodeInfo;
|
||||
begin
|
||||
if FCatchNodeInfo then
|
||||
i := FCatchNodeInfoList.CountAll;
|
||||
i := FCatchNodeInfoList.CountAll
|
||||
else
|
||||
i := 0;
|
||||
EndPascalCodeFoldBlock;
|
||||
if FAtLineStart then begin
|
||||
// If we are not at linestart, new folds could have been opened => handle as normal close
|
||||
|
@ -962,7 +962,7 @@ end;
|
||||
function TSynXMLSyn.StartXmlNodeCodeFoldBlock(ABlockType: TXmlCodeFoldBlockType;
|
||||
OpenPos: Integer; AName: String): TSynCustomCodeFoldBlock;
|
||||
begin
|
||||
if not FFoldConfig[ord(cfbtXmlNode)].Enabled then exit;
|
||||
if not FFoldConfig[ord(cfbtXmlNode)].Enabled then exit(nil);
|
||||
Result := inherited StartXmlNodeCodeFoldBlock(ord(ABlockType), OpenPos, AName);
|
||||
end;
|
||||
|
||||
|
@ -1582,7 +1582,9 @@ begin
|
||||
if (y1 < 0) or (y1 > Editor.LinesInWindow + 1) then
|
||||
y := -1; // not visible
|
||||
if y > 1 then
|
||||
y2 := Editor.RowToScreenRow(y-1);
|
||||
y2 := Editor.RowToScreenRow(y-1)
|
||||
else
|
||||
y2 := 0;
|
||||
|
||||
if (y > 0) and (y1 <> y2) or (y=1) then begin
|
||||
if Carets.Visual[Result] = nil then
|
||||
@ -1633,7 +1635,9 @@ begin
|
||||
end;
|
||||
|
||||
if y > 1 then
|
||||
y2 := Editor.RowToScreenRow(y-1);
|
||||
y2 := Editor.RowToScreenRow(y-1)
|
||||
else
|
||||
y2 := 0;
|
||||
|
||||
if (y1 <> y2) or (y=1) then begin
|
||||
if Carets.Visual[i] = nil then
|
||||
|
@ -2245,6 +2245,8 @@ function TRegExpr.ParseAtom (out flagp : integer) : PRegExprChar;
|
||||
begin
|
||||
Result := nil;
|
||||
flagp := WORST; // Tentatively.
|
||||
RangeBeg := #0;
|
||||
ret := nil;
|
||||
|
||||
inc (regparse);
|
||||
case (regparse - 1)^ of
|
||||
@ -3545,6 +3547,7 @@ function TRegExpr.ExecNext : boolean;
|
||||
|
||||
function TRegExpr.GetInputString : RegExprString;
|
||||
begin
|
||||
Result := '';
|
||||
if not Assigned (fInputString) then begin
|
||||
Error (reeGetInputStringWithoutInputString);
|
||||
EXIT;
|
||||
@ -3695,6 +3698,7 @@ var
|
||||
end;
|
||||
|
||||
begin
|
||||
Result := '';
|
||||
// Check programm and input string
|
||||
if not IsProgrammOk
|
||||
then EXIT;
|
||||
@ -3704,10 +3708,8 @@ begin
|
||||
end;
|
||||
// Prepare for working
|
||||
TemplateLen := length (ATemplate);
|
||||
if TemplateLen = 0 then begin // prevent nil pointers
|
||||
Result := '';
|
||||
if TemplateLen = 0 then // prevent nil pointers
|
||||
EXIT;
|
||||
end;
|
||||
TemplateBeg := pointer (ATemplate);
|
||||
TemplateEnd := TemplateBeg + TemplateLen;
|
||||
// Count result length for speed optimization.
|
||||
@ -3896,6 +3898,7 @@ function TRegExpr.Replace (AInputStr : RegExprString;
|
||||
function TRegExpr.DumpOp (op : TREOp) : RegExprString;
|
||||
// printable representation of opcode
|
||||
begin
|
||||
Result := '';
|
||||
case op of
|
||||
BOL: Result := 'BOL';
|
||||
EOL: Result := 'EOL';
|
||||
@ -3962,11 +3965,11 @@ function TRegExpr.Dump : RegExprString;
|
||||
Ch : REChar;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := '';
|
||||
if not IsProgrammOk //###0.929
|
||||
then EXIT;
|
||||
|
||||
op := EXACTLY;
|
||||
Result := '';
|
||||
s := programm + REOpSz;
|
||||
while op <> EEND do begin // While that wasn't END last time...
|
||||
op := s^;
|
||||
|
Loading…
Reference in New Issue
Block a user