mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-29 12:23:54 +02:00
SynEdit: more replacements of folded view
git-svn-id: trunk@63446 -
This commit is contained in:
parent
ff48695ac0
commit
821b66e4c2
@ -4222,16 +4222,18 @@ end;
|
||||
|
||||
procedure TCustomSynEdit.CodeFoldAction(iLine: integer);
|
||||
// iLine is 1 based as parameter
|
||||
var
|
||||
ScrY: Integer;
|
||||
begin
|
||||
if (iLine<=0) or (iLine>FTheLinesView.Count) then exit;
|
||||
dec(iLine);
|
||||
//DebugLn(['****** FoldAction at ',iLine,' scrline=',FFoldedLinesView.TextIndexToScreenLine(iLine), ' type ', SynEditCodeFoldTypeNames[FFoldedLinesView.FoldType[FFoldedLinesView.TextIndexToScreenLine(iLine)]], ' view topline=',FFoldedLinesView.TopLine ]);
|
||||
if FFoldedLinesView.FoldType[FFoldedLinesView.TextIndexToScreenLine(iLine)]
|
||||
ScrY := ToIdx(TextXYToScreenXY(Point(1, iLine)).y);
|
||||
//DebugLn(['****** FoldAction at ',iLine,' scrline=',ScrY, ' type ', SynEditCodeFoldTypeNames[FFoldedLinesView.FoldType[ScrY]], ' view topline=',FFoldedLinesView.TopLine ]);
|
||||
if FFoldedLinesView.FoldType[ScrY]
|
||||
* [cfCollapsedFold, cfCollapsedHide] <> []
|
||||
then
|
||||
FFoldedLinesView.UnFoldAtTextIndex(iLine)
|
||||
else
|
||||
if FFoldedLinesView.FoldType[FFoldedLinesView.TextIndexToScreenLine(iLine)]
|
||||
if FFoldedLinesView.FoldType[ScrY]
|
||||
* [cfFoldStart] <> []
|
||||
then
|
||||
FFoldedLinesView.FoldAtTextIndex(iLine);
|
||||
|
@ -159,8 +159,7 @@ begin
|
||||
tmp := FoldView.FoldType[AScreenLine];
|
||||
tmp2 := FoldView.FoldType[AScreenLine-1];
|
||||
FIsFoldHidePreviousLine := False;
|
||||
|
||||
if (AScreenLine = 0) and (FoldView.TextToViewIndex(FoldView.TextIndex[0]) = 0) and
|
||||
if (AScreenLine = 0) and (ToIdx(GutterArea.TextArea.TopLine) = 0) and
|
||||
(cfCollapsedHide in tmp2)
|
||||
then begin
|
||||
Result := cfCollapsedHide;
|
||||
@ -433,9 +432,11 @@ function TSynGutterCodeFolding.MaybeHandleMouseAction(var AnInfo: TSynEditMouseA
|
||||
HandleActionProc: TSynEditMouseActionHandler): Boolean;
|
||||
var
|
||||
tmp: TSynEditFoldLineCapability;
|
||||
ScrLine: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
tmp := FoldTypeForLine(FoldView.TextIndexToScreenLine(AnInfo.NewCaret.LinePos-1));
|
||||
ScrLine := ToIdx(AnInfo.NewCaret.ViewedLinePos) - ToIdx(GutterArea.TextArea.TopLine);
|
||||
tmp := FoldTypeForLine(ScrLine);
|
||||
case tmp of
|
||||
cfCollapsedFold, cfCollapsedHide:
|
||||
Result := HandleActionProc(FMouseActionsCollapsed.GetActionsForOptions(TCustomSynEdit(SynEdit).MouseOptions), AnInfo);
|
||||
@ -459,13 +460,15 @@ begin
|
||||
ACommand := AnAction.Command;
|
||||
if (ACommand = emcNone) then exit;
|
||||
line := AnInfo.NewCaret.LinePos;
|
||||
ScrLine := FoldView.TextIndexToScreenLine(Line-1);
|
||||
|
||||
ScrLine := ToIdx(AnInfo.NewCaret.ViewedLinePos) - ToIdx(GutterArea.TextArea.TopLine);
|
||||
|
||||
KeepVisible := 1;
|
||||
if FoldTypeForLine(ScrLine) = cfHideStart then KeepVisible := 0;
|
||||
|
||||
if (FoldTypeForLine(ScrLine) = cfCollapsedHide) then begin
|
||||
if IsFoldHidePreviousLine(ScrLine) then
|
||||
line := FoldView.TextIndex[ScrLine-1] + 1;
|
||||
line := ToPos(ViewedTextBuffer.DisplayView.ViewToTextIndex(ScrLine - 1 + ToIdx(GutterArea.TextArea.TopLine)));
|
||||
inc(line);
|
||||
KeepVisible := 0;
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user