@@ -16,6 +16,7 @@ namespace FlashDevelop.Dialogs
16
16
{
17
17
public class ShortcutDialog : SmartForm
18
18
{
19
+ private Timer updateTimer ;
19
20
private ToolStripMenuItem removeShortcut ;
20
21
private ToolStripMenuItem revertToDefault ;
21
22
private ToolStripMenuItem revertAllToDefault ;
@@ -41,6 +42,7 @@ public ShortcutDialog()
41
42
this . InitializeGraphics ( ) ;
42
43
this . PopulateListView ( "" , false ) ;
43
44
this . ApplyScaling ( ) ;
45
+ this . SetupUpdateTimer ( ) ;
44
46
}
45
47
46
48
#region Windows Form Designer Generated Code
@@ -287,8 +289,8 @@ private void PopulateListView(String filter, Boolean viewCustom)
287
289
foreach ( ShortcutItem item in ShortcutManager . RegisteredItems . Values )
288
290
{
289
291
if ( ! this . listView . Items . ContainsKey ( item . Id ) &&
290
- ( item . Id . ToLower ( ) . Contains ( filter . ToLower ( ) ) ||
291
- GetKeysAsString ( item . Custom ) . ToLower ( ) . Contains ( filter . ToLower ( ) ) ) )
292
+ ( item . Id . IndexOf ( filter , StringComparison . OrdinalIgnoreCase ) >= 0 ||
293
+ GetKeysAsString ( item . Custom ) . IndexOf ( filter , StringComparison . OrdinalIgnoreCase ) >= 0 ) )
292
294
{
293
295
if ( viewCustom && item . Custom == item . Default ) continue ;
294
296
ListViewItem lvi = new ListViewItem ( ) ;
@@ -439,14 +441,35 @@ private void ClearFilterClick(Object sender, EventArgs e)
439
441
}
440
442
441
443
/// <summary>
442
- /// Updated the list with the filter
444
+ /// Set up the timer for delayed list update with filters.
443
445
/// </summary>
444
- private void FilterTextChanged ( Object sender , EventArgs e )
446
+ private void SetupUpdateTimer ( )
447
+ {
448
+ updateTimer = new Timer ( ) ;
449
+ updateTimer . Enabled = false ;
450
+ updateTimer . Interval = 200 ;
451
+ updateTimer . Tick += UpdateTimer_Tick ;
452
+ }
453
+
454
+ /// <summary>
455
+ /// Update the list with filter.
456
+ /// </summary>
457
+ private void UpdateTimer_Tick ( Object sender , EventArgs e )
445
458
{
459
+ updateTimer . Enabled = false ;
446
460
String searchText = this . filterTextBox . Text . Trim ( ) ;
447
461
this . PopulateListView ( searchText , viewCustom . Checked ) ;
448
462
}
449
463
464
+ /// <summary>
465
+ /// Restart the timer for updating the list.
466
+ /// </summary>
467
+ private void FilterTextChanged ( Object sender , EventArgs e )
468
+ {
469
+ updateTimer . Stop ( ) ;
470
+ updateTimer . Start ( ) ;
471
+ }
472
+
450
473
/// <summary>
451
474
/// Closes the shortcut dialog
452
475
/// </summary>
0 commit comments