Skip to content

Commit

Permalink
const cTagPersistentFoldRange
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Jun 30, 2019
1 parent 480bcaa commit bf45a4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion atsynedit/atsynedit_cmd_misc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ begin

if Fold.FindRangeWithPlusAtLine(Y1)>=0 then exit;

Fold.Add(1, Y1, Y2, false, '', -1);
Fold.Add(1, Y1, Y2, false, '', cTagPersistentFoldRange);
DoRangeFold(Fold.Count-1);

Result:= [cResultCaretAny, cResultFoldChange];
Expand Down
8 changes: 5 additions & 3 deletions atsynedit/atsynedit_ranges.pas
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ TATSynRanges = class
procedure Update(AChange: TATLineChangeKind; ALineIndex, AItemCount: integer);
end;

const
cTagPersistentFoldRange = -1;

implementation

uses
Expand Down Expand Up @@ -351,7 +354,6 @@ function TATSynRanges.MessageText(Cnt: integer): string;
end;

procedure TATSynRanges.Update(AChange: TATLineChangeKind; ALineIndex, AItemCount: integer);
//Tag=-1 means persistent range, from command "Fold selection"
var
Rng: PATSynRange;
i: integer;
Expand All @@ -364,7 +366,7 @@ procedure TATSynRanges.Update(AChange: TATLineChangeKind; ALineIndex, AItemCount
for i:= FList.Count-1 downto 0 do
begin
Rng:= FList.ItemPtr(i);
if Rng^.Tag<>-1 then Continue;
if Rng^.Tag<>cTagPersistentFoldRange then Continue;

if Rng^.Y>=ALineIndex+AItemCount then
begin
Expand Down Expand Up @@ -393,7 +395,7 @@ procedure TATSynRanges.Update(AChange: TATLineChangeKind; ALineIndex, AItemCount
for i:= FList.Count-1 downto 0 do
begin
Rng:= FList.ItemPtr(i);
if Rng^.Tag<>-1 then Continue;
if Rng^.Tag<>cTagPersistentFoldRange then Continue;

if Rng^.Y>=ALineIndex then
begin
Expand Down

0 comments on commit bf45a4b

Please sign in to comment.