Skip to content

Commit

Permalink
Add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnlaan committed Jun 16, 2024
1 parent 380c51b commit f52e67e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Components/ScintEdit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,8 @@ procedure TScintEdit.ScrollCaretIntoView;


procedure TScintEdit.SelectAllOccurrences(const Options: TScintFindOptions);
{ At the moment this does not automatically expand folds, unlike VSCode. Also
see SelectNextOccurrence. }
begin
Call(SCI_TARGETWHOLEDOCUMENT, 0, 0);
Call(SCI_SETSEARCHFLAGS, GetSearchFlags(Options), 0);
Expand All @@ -1325,18 +1327,20 @@ procedure TScintEdit.SelectAllOccurrences(const Options: TScintFindOptions);
procedure TScintEdit.SelectAndEnsureVisible(const Range: TScintRange);
begin
CheckPosRange(Range.StartPos, Range.EndPos);

{ If the range is in a collapsed section, expand it }
var StartLine := GetLineFromPosition(Range.StartPos);
var EndLine := GetLineFromPosition(Range.EndPos);
for var Line := StartLine to EndLine do
EnsureLineVisible(Line);

{ Select }
Selection := Range;
end;

procedure TScintEdit.SelectNextOccurrence(const Options: TScintFindOptions);
{ At the moment this does not automatically expand folds, unlike VSCode. Also
see SelectAllOccurrences. }
begin
Call(SCI_TARGETWHOLEDOCUMENT, 0, 0);
Call(SCI_SETSEARCHFLAGS, GetSearchFlags(Options), 0);
Expand Down

0 comments on commit f52e67e

Please sign in to comment.