Skip to content

Commit

Permalink
Delay searching for better user experience
Browse files Browse the repository at this point in the history
  • Loading branch information
BAndysc committed Apr 12, 2022
1 parent ad0ca7f commit dde0ec6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/AvaloniaEdit/Search/SearchPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Threading;
using Avalonia.VisualTree;
using AvaloniaEdit.Document;
using AvaloniaEdit.Editing;
Expand Down Expand Up @@ -185,11 +187,12 @@ private void UpdateSearch()

static SearchPanel()
{
UseRegexProperty.Changed.Subscribe(SearchPatternChangedCallback);
MatchCaseProperty.Changed.Subscribe(SearchPatternChangedCallback);
WholeWordsProperty.Changed.Subscribe(SearchPatternChangedCallback);
SearchPatternProperty.Changed.Subscribe(SearchPatternChangedCallback);

UseRegexProperty.Changed.Cast<AvaloniaPropertyChangedEventArgs>()
.Merge(MatchCaseProperty.Changed)
.Merge(WholeWordsProperty.Changed)
.Merge(SearchPatternProperty.Changed)
.Throttle(TimeSpan.FromMilliseconds(400), AvaloniaScheduler.Instance)
.Subscribe(SearchPatternChangedCallback);
MarkerBrushProperty.Changed.Subscribe(MarkerBrushChangedCallback);
}

Expand Down

0 comments on commit dde0ec6

Please sign in to comment.