mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 04:49:40 +02:00
SynEdit: Fixed a folding issue, and assert
git-svn-id: trunk@30453 -
This commit is contained in:
parent
24c7af863a
commit
62833f223a
@ -27,6 +27,13 @@ unit SynEditFoldedView;
|
||||
{$coperators on}
|
||||
{$IFDEF CPUPOWERPC} {$INLINE OFF} {$ENDIF} (* Workaround for bug 12576 (fpc) see bugs.freepascal.org/view.php?id=12576 *)
|
||||
|
||||
{$IFOPT C+}
|
||||
{$DEFINE SynAssertFold}
|
||||
{$ENDIF}
|
||||
{$IFDEF SynAssert}
|
||||
{$DEFINE SynAssertFold}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF SynFoldDebug}
|
||||
{$DEFINE SynDebug}
|
||||
{$DEFINE SynFoldSaveDebug}
|
||||
@ -1897,6 +1904,9 @@ begin
|
||||
|
||||
EndLineIdx := FHighlighter.FoldEndLine(ANode.StartLine - ANode.SourceLineOffset - 1,
|
||||
ANode.FoldIndex);
|
||||
{$IFDEF SynAssertFold}
|
||||
SynAssert(EndLineIdx >= 0, 'TSynFoldNodeInfoHelper.GotoNodeClosePos: Bad EndLineIdx=%d # Anode: StartLine=%d SrcLOffs=%d ColIdx=%d FoldCol=%d', [EndLineIdx, ANode.StartLine, ANode.SourceLineOffset, ANode.FoldIndex, ANode.FoldColumn]);
|
||||
{$ENDIF}
|
||||
Cnt := FHighlighter.FoldNodeInfoCount[EndLineIdx, [sfaClose, sfaFold]];
|
||||
EndCol := 0;
|
||||
while EndCol < Cnt do begin
|
||||
@ -3579,6 +3589,7 @@ begin
|
||||
continue;
|
||||
end;
|
||||
|
||||
// TODO: missing check, that hl-node is hideable
|
||||
fldinf := FoldProvider.InfoForFoldAtTextIndex(AStartIndex, ColIndex, IsHide);
|
||||
if not NFolded.IsInFold then
|
||||
fFoldTree.InsertNewFold(AStartIndex+1+AVisibleLines, ColIndex,
|
||||
@ -3762,30 +3773,36 @@ var
|
||||
end;
|
||||
|
||||
var
|
||||
FldLine, FldIndex, FldLen, FndLen, FldCol: Integer;
|
||||
FldSrcLine, FldSrcIndex, FLdNodeLine, FldLen, FndLen, FldCol: Integer;
|
||||
i, j, CurLen: Integer;
|
||||
PrevFldLine: Integer;
|
||||
PrevFldSrcLine: Integer;
|
||||
SubTree: TSynTextFoldAVLTree;
|
||||
IsHide: Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
FldLine := doStart;
|
||||
FldSrcLine := doStart;
|
||||
while node.IsInFold do begin
|
||||
PrevFldLine := FldLine;
|
||||
FldLine := node.SourceLine; // the 1-based cfCollapsed (last visible) Line (or 1st hidden)
|
||||
FldIndex := FldLine - 1;
|
||||
PrevFldSrcLine := FldSrcLine;
|
||||
FldSrcLine := node.SourceLine; // the 1-based cfCollapsed (last visible) Line (or 1st hidden)
|
||||
FLdNodeLine := node.StartLine; // the 1 based, first hidden line
|
||||
FldSrcIndex := FldSrcLine - 1;
|
||||
FldLen := node.FullCount;
|
||||
if (FldLen <= 0) then begin
|
||||
{$IFDEF SynFoldDebug}debugln(['>>FOLD-- FixFolding: Remove node with len<0 FldLine=', FldLine]);{$ENDIF}
|
||||
{$IFDEF SynFoldDebug}debugln(['>>FOLD-- FixFolding: Remove node with len<0 FldSrcLine=', FldSrcLine]);{$ENDIF}
|
||||
DoRemoveNode(node);
|
||||
continue;
|
||||
end;
|
||||
|
||||
if (FldLine > PrevFldLine) then begin
|
||||
//{$IFDEF SynAssertFold}
|
||||
//With mixed fold/hide => line goes up/down
|
||||
//SynAssert(FldSrcLine >= PrevFldSrcLine, 'TSynEditFoldedView.FixFolding: FoldLine went backwards now %d was %d', [FldSrcLine, PrevFldSrcLine]);
|
||||
//{$ENDIF}
|
||||
if (FldSrcLine <> PrevFldSrcLine) then begin
|
||||
// Next Line
|
||||
AtColumn := 0;
|
||||
FldInfos := nil;
|
||||
FldInfos := FoldProvider.InfoListForFoldsAtTextIndex(FldIndex, False);
|
||||
// AtColumn is used for nodes, behing the HLs index-range (fncHighlighterEx, fncBlockSelection)
|
||||
// TODO: At Colum may be wrong for mixed fold/hide
|
||||
FldInfos := FoldProvider.InfoListForFoldsAtTextIndex(FldSrcIndex, False);
|
||||
MaxCol := length(FldInfos)-1;
|
||||
end;
|
||||
|
||||
@ -3802,7 +3819,7 @@ var
|
||||
j := abs(FldInfos[i].Column - node.FoldColumn);
|
||||
if (j > 0) and (j < node.FoldColumnLen) then begin
|
||||
//maybe
|
||||
FndLen := FoldProvider.FoldLineLength(FldIndex, i);
|
||||
FndLen := FoldProvider.FoldLineLength(FldSrcIndex, i);
|
||||
if node.IsHide then inc(FndLen);
|
||||
if FndLen <> node.FullCount then Continue;
|
||||
debugln('******** FixFolding: Adjusting x pos');
|
||||
@ -3810,7 +3827,7 @@ var
|
||||
end;
|
||||
if (FndLen > 0) or (FldInfos[i].Column = node.FoldColumn) then begin
|
||||
if FndLen < 0 then begin
|
||||
FndLen := FoldProvider.FoldLineLength(FldIndex, i);
|
||||
FndLen := FoldProvider.FoldLineLength(FldSrcIndex, i);
|
||||
if node.IsHide then inc(FndLen);
|
||||
end;
|
||||
if abs(FndLen - node.FullCount) > 1 then continue;
|
||||
@ -3819,7 +3836,7 @@ var
|
||||
(node.FoldIndex <> i)
|
||||
then
|
||||
Result := true;
|
||||
{$IFDEF SynFoldDebug}if (node.fData.Classification <> fncHighlighter) then debugln(['>>FOLD-- FixFolding: set Node to fncHighlighter (FOUND) FldLine=', FldLine]);{$ENDIF}
|
||||
{$IFDEF SynFoldDebug}if (node.fData.Classification <> fncHighlighter) then debugln(['>>FOLD-- FixFolding: set Node to fncHighlighter (FOUND) FldSrcLine=', FldSrcLine]);{$ENDIF}
|
||||
node.fData.Classification := fncHighlighter;
|
||||
node.FoldColumn := FldInfos[i].Column;
|
||||
node.fData.FoldIndex := i;
|
||||
@ -3828,7 +3845,7 @@ var
|
||||
end;
|
||||
end;
|
||||
if i = MaxCol then begin
|
||||
{$IFDEF SynFoldDebug}debugln(['>>FOLD-- FixFolding: set Node to fncHighlighterEx (NOT FOUND) FldLine=', FldLine]);{$ENDIF}
|
||||
{$IFDEF SynFoldDebug}debugln(['>>FOLD-- FixFolding: set Node to fncHighlighterEx (NOT FOUND) FldSrcLine=', FldSrcLine]);{$ENDIF}
|
||||
node.fData.Classification := fncHighlighterEx;
|
||||
node.fData.FoldIndex := MaxCol + AtColumn;
|
||||
inc(AtColumn);
|
||||
@ -3843,9 +3860,9 @@ var
|
||||
end;
|
||||
|
||||
if (node.fData.Nested <> nil) then begin
|
||||
SubTree := doFoldTree.TreeForNestedNode(node.fData, FldLine+1);
|
||||
SubTree := doFoldTree.TreeForNestedNode(node.fData, FLdNodeLine);
|
||||
CurLen := node.MergedLineCount;
|
||||
if DoFixFolding(FldLine, FldLine + CurLen + 1, AtColumn, SubTree, SubTree.FindFirstFold)
|
||||
if DoFixFolding(FldSrcLine, FLdNodeLine + CurLen, AtColumn, SubTree, SubTree.FindFirstFold)
|
||||
then begin
|
||||
if CurLen > FldLen then begin
|
||||
node.fData.MergedLineCount:= max(node.FullCount,
|
||||
|
@ -4,6 +4,9 @@ unit SynEditMarks;
|
||||
{$IFOPT C+}
|
||||
{$DEFINE AssertSynMemIndex}
|
||||
{$ENDIF}
|
||||
{$IFDEF SynAssert}
|
||||
{$DEFINE AssertSynMemIndex}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
|
@ -76,6 +76,9 @@ function fsXor (s1,s2 : TFontStyles) : TFontStyles; inline;
|
||||
function CreateTabsAndSpaces(StartPos, SpaceLen, TabWidth: integer;
|
||||
UseTabs: boolean): string;
|
||||
|
||||
procedure SynAssert(Condition: Boolean; Msg: String);
|
||||
procedure SynAssert(Condition: Boolean; Msg: String; Args: Array of Const);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -232,5 +235,15 @@ begin
|
||||
Result:=StringOfChar(#9,TabCount)+Result;
|
||||
end;
|
||||
|
||||
procedure SynAssert(Condition: Boolean; Msg: String);
|
||||
begin
|
||||
if not Condition then raise Exception.Create(Msg);
|
||||
end;
|
||||
|
||||
procedure SynAssert(Condition: Boolean; Msg: String; Args: array of const);
|
||||
begin
|
||||
if not Condition then raise Exception.Create(Format(Msg, Args));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -25,6 +25,10 @@ unit SynEditTextBase;
|
||||
{$IFOPT C+}
|
||||
{$DEFINE AssertSynMemIndex}
|
||||
{$ENDIF}
|
||||
{$IFDEF SynAssert}
|
||||
{$DEFINE AssertSynMemIndex}
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
interface
|
||||
|
||||
|
@ -22,7 +22,7 @@ type
|
||||
TTestFoldedView = class(TTestBaseHighlighterPas)
|
||||
private
|
||||
FoldedView: TSynEditFoldedView;
|
||||
DoAutoFoldDescTests: Boolean;
|
||||
DoAutoFoldDescTests, DoAutoFoldDescTestsReadOnly: Boolean;
|
||||
DoAllowScrollPastEof: Boolean;
|
||||
EnableDebug: Boolean;
|
||||
|
||||
@ -38,6 +38,7 @@ type
|
||||
function TestText4: TStringArray;
|
||||
function TestText5: TStringArray;
|
||||
function TestText6: TStringArray;
|
||||
function TestText7: TStringArray;
|
||||
function TestTextHide(ALen: Integer): TStringArray;
|
||||
function TestTextHide2(ALen: Integer): TStringArray;
|
||||
function TestTextHide3: TStringArray;
|
||||
@ -52,6 +53,8 @@ type
|
||||
AFoldAtSkip: Boolean; AExpectedLines: Array of Integer);
|
||||
procedure TstFold(AName: String; AFoldAtIndex, AFoldAtColum, AFoldAtColCnt: integer;
|
||||
AFoldAtSkip: Boolean; AVisibleLines: Integer; AExpectedLines: Array of Integer);
|
||||
procedure TstUnFold(AName: String; AFoldAtIndex, AFoldAtColum, AFoldAtColCnt: integer;
|
||||
AFoldAtSkip: Boolean; AVisibleLines: Integer; AExpectedLines: Array of Integer);
|
||||
procedure TstUnFoldAtCaret(AName: String; X, Y: integer; AExpectedLines: Array of Integer);
|
||||
procedure TstTxtIndexToViewPos(AName: String; AExpectedPairs: Array of Integer; ADoReverse: Boolean = false);
|
||||
procedure TstViewPosToTextIndex(AName: String; AExpectedPairs: Array of Integer; ADoReverse: Boolean = false);
|
||||
@ -106,6 +109,14 @@ begin
|
||||
TestFoldedText(AName, AExpectedLines);
|
||||
end;
|
||||
|
||||
procedure TTestFoldedView.TstUnFold(AName: String; AFoldAtIndex, AFoldAtColum,
|
||||
AFoldAtColCnt: integer; AFoldAtSkip: Boolean; AVisibleLines: Integer;
|
||||
AExpectedLines: array of Integer);
|
||||
begin
|
||||
FoldedView.UnFoldAtTextIndex(AFoldAtIndex, AFoldAtColum, AFoldAtColCnt, AFoldAtSkip, AVisibleLines);
|
||||
TestFoldedText(AName, AExpectedLines);
|
||||
end;
|
||||
|
||||
procedure TTestFoldedView.TstUnFoldAtCaret(AName: String; X, Y: integer; AExpectedLines: Array of Integer);
|
||||
begin
|
||||
SynEdit.CaretXY := Point(X, Y);
|
||||
@ -177,7 +188,7 @@ procedure TTestFoldedView.TestFoldedText(AName: String; ALines: array of Integer
|
||||
var
|
||||
ExpTxt: String;
|
||||
i: Integer;
|
||||
tmp: String;
|
||||
tmp, tmp1, tmp2, tmp3: String;
|
||||
function GetFoldedText: String;
|
||||
var I: Integer;
|
||||
begin
|
||||
@ -191,9 +202,24 @@ begin
|
||||
for i := 0 to high(ALines) do ExpTxt := ExpTxt + SynEdit.Lines[ALines[i]] + LineEnding;
|
||||
TestCompareString('', ExpTxt, GetFoldedText);
|
||||
|
||||
if DoAutoFoldDescTests or DoAutoFoldDescTestsReadOnly then begin
|
||||
tmp := FoldedView.GetFoldDescription(0, 1, -1, -1, False, False);
|
||||
tmp1 := FoldedView.GetFoldDescription(0, 1, -1, -1, False, True);
|
||||
tmp2 := FoldedView.GetFoldDescription(0, 1, -1, -1, True, False);
|
||||
tmp3 := FoldedView.GetFoldDescription(0, 1, -1, -1, True, True);
|
||||
end;
|
||||
|
||||
|
||||
FoldedView.FixFoldingAtTextIndex(0, SynEdit.Lines.Count-1);
|
||||
TestCompareString('after FixFolding', ExpTxt, GetFoldedText);
|
||||
|
||||
if DoAutoFoldDescTests or DoAutoFoldDescTestsReadOnly then begin
|
||||
TestCompareString('GetFoldDesc after Fix fold 1', tmp, FoldedView.GetFoldDescription(0, 1, -1, -1, False, False));
|
||||
TestCompareString('GetFoldDesc after Fix fold 2', tmp1, FoldedView.GetFoldDescription(0, 1, -1, -1, False, True));
|
||||
TestCompareString('GetFoldDesc after Fix fold 3', tmp2, FoldedView.GetFoldDescription(0, 1, -1, -1, True, False));
|
||||
TestCompareString('GetFoldDesc after Fix fold 4', tmp3, FoldedView.GetFoldDescription(0, 1, -1, -1, True, True));
|
||||
end;
|
||||
|
||||
if DoAutoFoldDescTests then begin
|
||||
tmp := FoldedView.GetFoldDescription(0, 1, -1, -1, False, False);
|
||||
//debugln(MyDbg(tmp));
|
||||
@ -347,6 +373,38 @@ begin
|
||||
Result[7]:= '';
|
||||
end;
|
||||
|
||||
function TTestFoldedView.TestText7: TStringArray;
|
||||
begin
|
||||
SetLength(Result, 27);
|
||||
Result[0] := 'program Foo;';
|
||||
Result[1] := '{$IFDEF x1}';
|
||||
Result[2] := '{$IFDEF x2} {$IFDEF x3}';
|
||||
Result[3] := '{$IFDEF x4} {$IFDEF x5} {$IFDEF x6} {$IFDEF x7}';
|
||||
Result[4] := '{$IFDEF x8} {$IFDEF x9} {$IFDEF xA}';
|
||||
Result[5] := '//foo A';
|
||||
Result[6] := '{$ENDIF XA}';
|
||||
Result[7] := '//foo 9';
|
||||
Result[8] := '{$ENDIF X9}';
|
||||
Result[9] := '//foo 8';
|
||||
Result[10] := '{$ENDIF X8}';
|
||||
Result[11] := '//foo 7';
|
||||
Result[12] := '{$ENDIF X7}';
|
||||
Result[13] := '//foo 6';
|
||||
Result[14] := '{$ENDIF X6}';
|
||||
Result[15] := '//foo 5';
|
||||
Result[16] := '{$ENDIF X5}';
|
||||
Result[17] := '//foo 4';
|
||||
Result[18] := '{$ENDIF X4}';
|
||||
Result[19] := '//foo 3';
|
||||
Result[20] := '{$ENDIF X3}';
|
||||
Result[21] := '//foo 2';
|
||||
Result[22] := '{$ENDIF X2}';
|
||||
Result[23] := '//foo 1';
|
||||
Result[24] := '{$ENDIF X1}';
|
||||
Result[25] := '//bar';
|
||||
Result[26] := '';
|
||||
end;
|
||||
|
||||
function TTestFoldedView.TestTextHide(ALen: Integer): TStringArray;
|
||||
begin
|
||||
SetLength(Result, 3+ALen);
|
||||
@ -402,6 +460,8 @@ end;
|
||||
|
||||
procedure TTestFoldedView.TestFold;
|
||||
procedure RunTest;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
PushBaseName('');
|
||||
|
||||
@ -608,6 +668,123 @@ procedure TTestFoldedView.TestFold;
|
||||
AssertEquals(FoldedView.Count, 4999-2);
|
||||
{%endregion}
|
||||
|
||||
{%region Text7 fold at indes, skip, ...}
|
||||
(* Arguments for (Un)FoldAt* (Line, ViewPos, TextIndex):
|
||||
- ColumnIndex (0-based)
|
||||
Can be negative, to access the highest(-1) available, 2nd highest(-2) ...
|
||||
If negative, count points downward
|
||||
- ColCount = 0 => all
|
||||
- Skip => Do not count nodes that are already in the desired state
|
||||
(or can not archive the desired state: e.g. can not hide)
|
||||
- AVisibleLines: 0 = Hide / 1 = Fold
|
||||
*)
|
||||
TstSetText('Text7 fold at indes, skip, ...', TestText7);
|
||||
{%region fold one}
|
||||
for i := 0 to 1 do begin
|
||||
PushBaseName('X='+IntToStr(i));
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (pos): 0,1,x', 3, 0, 1, i=0, 1, [0, 1, 2, 3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (pos): 1,1,x', 3, 1, 1, i=0, 1, [0, 1, 2, 3, 17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (pos): 2,1,x', 3, 2, 1, i=0, 1, [0, 1, 2, 3, 15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (pos): 3,1,x', 3, 3, 1, i=0, 1, [0, 1, 2, 3, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('NOT fold one col (pos): 4,1,x', 3, 4, 1, i=0, 1, [0, 1, 2, 3, 4,5,6,7,8,9,10,11,12, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (neg): -4,1,x', 3, -4, 1, i=0, 1, [0, 1, 2, 3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (neg): -3,1,x', 3, -3, 1, i=0, 1, [0, 1, 2, 3, 17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (neg): -2,1,x', 3, -2, 1, i=0, 1, [0, 1, 2, 3, 15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('fold one col (neg): -1,1,x', 3, -1, 1, i=0, 1, [0, 1, 2, 3, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('NOT fold one col (neg): -5,1,x', 3, -5, 1, i=0, 1, [0, 1, 2, 3, 4,5,6,7,8,9,10,11,12, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
|
||||
DoAutoFoldDescTestsReadOnly := DoAutoFoldDescTests;
|
||||
DoAutoFoldDescTests := False;
|
||||
// SKIP, if DoAutoFoldDescTests, since fold-info-apply checks for correct node type, and this code force hide.
|
||||
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide one col (pos): 0,1,x', 3, 0, 1, i=0, 0, [0, 1, 2, 19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide one col (pos): 1,1,x', 3, 1, 1, i=0, 0, [0, 1, 2, 17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide one col (pos): 2,1,x', 3, 2, 1, i=0, 0, [0, 1, 2, 15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide one col (pos): 3,1,x', 3, 3, 1, i=0, 0, [0, 1, 2, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('NOT hide one col (pos): 4,1,x', 3, 4, 1, i=0, 0, [0, 1, 2, 3, 4,5,6,7,8,9,10,11,12, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide all-after col (pos): 0,1,x', 3, 0, 0, i=0, 0, [0, 1, 2, 19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide all-after col (pos): 1,1,x', 3, 1, 0, i=0, 0, [0, 1, 2, 17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide all-after col (pos): 2,1,x', 3, 2, 0, i=0, 0, [0, 1, 2, 15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('hide all-after col (pos): 3,1,x', 3, 3, 0, i=0, 0, [0, 1, 2, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
SynEdit.UnfoldAll;
|
||||
TstFold('NOT hide all-after col (pos): 4,1,x', 3, 4, 1, i=0, 0, [0, 1, 2, 3, 4,5,6,7,8,9,10,11,12, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
DoAutoFoldDescTests := DoAutoFoldDescTestsReadOnly;
|
||||
|
||||
|
||||
PopBaseName;
|
||||
end;
|
||||
{%endregion}
|
||||
|
||||
{%region fold two}
|
||||
{%region 1st:: 0,1,F}
|
||||
// 1st:: 0,1,F // SKIP=False
|
||||
SynEdit.UnfoldAll; PushBaseName('(1st:: 0,1,F / 2nd:: x=1 no-sk c=1)');
|
||||
TstFold (' fold pre-one col (pos): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstFold (' fold 2nd col (pos/no-sk): 1,1,F', 3, 1, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstUnFold('UNfold 1st col (pos/no-sk): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
SynEdit.UnfoldAll; PushBaseName('(1st:: 0,1,F / 2nd:: x=2 no-sk c=1)');
|
||||
TstFold (' fold pre-one col (pos): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstFold (' fold 3rd col (pos/no-sk): 2,1,F', 3, 2, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstUnFold('UNfold 1st col (pos/no-sk): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
SynEdit.UnfoldAll; PushBaseName('(1st:: 0,1,F / 2nd:: x=3 no-sk c=1)');
|
||||
TstFold (' fold pre-one col (pos): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstFold (' fold 4th col (pos/no-sk): 3,1,F', 3, 3, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstUnFold('UNfold 1st col (pos/no-sk): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
// 1st:: 0,1,F // SKIP=True
|
||||
SynEdit.UnfoldAll; PopPushBaseName('(1st:: 0,1,F / 2nd:: x=0 skip c=1)');
|
||||
TstFold (' fold pre-one col (pos): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstFold (' fold 2nd col (pos/skip): 0,1,T', 3, 0, 1, True, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
// TstUnFold('UNfold 1st col (pos/no-sk): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
SynEdit.UnfoldAll; PopPushBaseName('(1st:: 0,1,F / 2nd:: x=1 skip c=1)');
|
||||
TstFold (' fold pre-one col (pos): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstFold (' fold 3rd col (pos/skip): 1,1,T', 3, 1, 1, True, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
// TstUnFold('UNfold 1st col (pos/no-sk): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
|
||||
SynEdit.UnfoldAll; PopPushBaseName('(1st:: 0,1,F / 2nd:: x=2 skip c=1)');
|
||||
TstFold (' fold pre-one col (pos): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
TstFold (' fold 4th col (pos/skip): 2,1,T', 3, 2, 1, True, 1, [0,1,2,3, 19, 20, 21, 22, 23, 24, 25]);
|
||||
// TstUnFold('UNfold 1st col (pos/no-sk): 0,1,F', 3, 0, 1, False, 1, [0,1,2,3, 13,14,15,16,17,18,19, 20, 21, 22, 23, 24, 25]);
|
||||
{%endregion}
|
||||
|
||||
{%region 1st:: 1,1,F}
|
||||
{%endregion}
|
||||
|
||||
{%region 1st:: -1,1,F}
|
||||
{%endregion}
|
||||
|
||||
{%region 1st:: -2,1,F}
|
||||
{%endregion}
|
||||
{%endregion}
|
||||
{%endregion Text7 fold at indes, skip, ...}
|
||||
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
@ -685,6 +862,15 @@ begin
|
||||
TestFoldedText('(newline on srcline)', [0, 1]);
|
||||
TestNodeAtPos('(newline on srcline)', 1, 2);
|
||||
PopBaseName;
|
||||
|
||||
TstSetText('Simple 2: edit del foldable line', TestText3);
|
||||
TstFold('', 7, [0, 1, 2, 3, 4, 5, 6, 7, 10, 11]);
|
||||
SetCaretAndSel(1,3, 1,4);
|
||||
SynEdit.CommandProcessor(ecDeleteChar, '', nil);
|
||||
TestFoldedText('fold after', [0, 1, 2, 3, 4, 5, 6, 9, 10]);
|
||||
|
||||
|
||||
PopBaseName;
|
||||
{%endregion}
|
||||
|
||||
{%region Nested}
|
||||
|
Loading…
Reference in New Issue
Block a user