SynEdit: right click fold-gutter crashes, if no fold-highlighter is avail. Issue #14855

git-svn-id: trunk@22362 -
This commit is contained in:
martin 2009-10-31 17:26:55 +00:00
parent 4483337f54
commit e81f70915d

View File

@ -222,32 +222,34 @@ begin
begin begin
FPopUp.Items.Clear; FPopUp.Items.Clear;
c := FFoldView.OpenFoldCount(line-1); c := FFoldView.OpenFoldCount(line-1);
SetLength(FMenuInf,c); if c > 0 then begin
for i := c-1 downto 0 do begin SetLength(FMenuInf,c);
inf := FFoldView.OpenFoldInfo(line-1, i); for i := c-1 downto 0 do begin
FMenuInf[i] := inf; inf := FFoldView.OpenFoldInfo(line-1, i);
if (i < c-1) and (FMenuInf[i+1].LineNum = line) and (inf.LineNum <> line) FMenuInf[i] := inf;
then begin if (i < c-1) and (FMenuInf[i+1].LineNum = line) and (inf.LineNum <> line)
then begin
m := TMenuItem.Create(FPopUp);
m.Caption := cLineCaption;
m.Tag := -1;
FPopUp.Items.Add(m);
end;
s := copy(inf.Text, 1, inf.HNode.LogXStart-1);
if length(s) > 30 then s := copy(s,1,15) + '...' + copy(s, inf.HNode.LogXStart-11,10);
s := s + copy(inf.Text, inf.HNode.LogXStart, 30 + (30 - length(s)));
s2 := '';
if inf.OpenCount > 1 then
s2 := format(' (%d/%d)', [inf.ColIndex+1, inf.OpenCount]);
m := TMenuItem.Create(FPopUp); m := TMenuItem.Create(FPopUp);
m.Caption := cLineCaption; m.Caption := format('%4d %-12s %s', [ inf.LineNum, inf.Keyword+s2+':', s]);
m.Tag := -1; m.ShowAlwaysCheckable := true;
m.Checked := inf.Folded;
m.Tag := i;
m.OnClick := {$IFDEF FPC}@{$ENDIF}PopClicked;
FPopUp.Items.Add(m); FPopUp.Items.Add(m);
end; end;
s := copy(inf.Text, 1, inf.HNode.LogXStart-1); FPopUp.PopUp;
if length(s) > 30 then s := copy(s,1,15) + '...' + copy(s, inf.HNode.LogXStart-11,10);
s := s + copy(inf.Text, inf.HNode.LogXStart, 30 + (30 - length(s)));
s2 := '';
if inf.OpenCount > 1 then
s2 := format(' (%d/%d)', [inf.ColIndex+1, inf.OpenCount]);
m := TMenuItem.Create(FPopUp);
m.Caption := format('%4d %-12s %s', [ inf.LineNum, inf.Keyword+s2+':', s]);
m.ShowAlwaysCheckable := true;
m.Checked := inf.Folded;
m.Tag := i;
m.OnClick := {$IFDEF FPC}@{$ENDIF}PopClicked;
FPopUp.Items.Add(m);
end; end;
FPopUp.PopUp;
end; end;
else else
Result := False; Result := False;