Skip to content

Commit f9d8501

Browse files
committed
remove ability to ignore space; decrease delay
the previous implementation of the timer created issues where characters could sometimes be ignored altogether. It also didn't play nice with my earlier opitimization that ignored space presses in most cases, so spaces will no longer be ignored.
1 parent 2ac53aa commit f9d8501

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

NppNavigateTo/Forms/FrmNavigateTo.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ partial class FrmNavigateTo : Form
9393

9494
private bool tooManyResultsToHighlight { get; set; } = false;
9595

96-
private bool lastCharCannotChangeResults { get; set; } = false;
97-
9896
public FrmNavigateTo(IScintillaGateway editor, INotepadPPGateway notepad)
9997
{
10098
this.editor = editor;
@@ -531,7 +529,6 @@ private void dataGridView1_MouseClick(object sender, MouseEventArgs e)
531529

532530
private void SearchComboBoxKeyDown(object sender, KeyEventArgs e)
533531
{
534-
lastCharCannotChangeResults = false;
535532
switch (e.KeyCode)
536533
{
537534
case Keys.Back:
@@ -587,14 +584,6 @@ private void SearchComboBoxKeyDown(object sender, KeyEventArgs e)
587584
e.Handled = true;
588585
e.SuppressKeyPress = true;
589586
break;
590-
591-
case Keys.Space:
592-
// adding space can't change the results unless:
593-
// - the space is part of a character class in a glob (e.g. "[ ]" matches literal whitespace)
594-
// - the space would push the number of chars in the search box over the min char limit
595-
int minLength = FrmSettings.Settings.GetIntSetting(Settings.minTypeCharLimit);
596-
lastCharCannotChangeResults = searchComboBox.Text.Length != minLength && searchComboBox.Text.IndexOf('[') == -1;
597-
break;
598587
}
599588
}
600589

@@ -671,8 +660,6 @@ private bool NavigateGridDown(bool isShiftPressed)
671660

672661
private void SearchComboBoxTextChanged(object sender, EventArgs e)
673662
{
674-
if (lastCharCannotChangeResults)
675-
return;
676663
lastKeyPressTimer.Start();
677664
lastKeypressTicks = System.DateTime.UtcNow.Ticks;
678665
}
@@ -682,7 +669,7 @@ private void LastKeyPressTimer_Elapsed(object sender, EventArgs e)
682669
Invoke(new Action(() =>
683670
{
684671
// allow keypresses more recent than the interval, because we can't rely on precise timing of this event firing
685-
if (System.DateTime.UtcNow.Ticks <= lastKeypressTicks + System.TimeSpan.TicksPerMillisecond * lastKeyPressTimerInterval / 4)
672+
if (System.DateTime.UtcNow.Ticks <= lastKeypressTicks + System.TimeSpan.TicksPerMillisecond * lastKeyPressTimerInterval / 10)
686673
return;
687674
int textLength = searchComboBox.Text.Length;
688675
bool emptyText = string.IsNullOrWhiteSpace(searchComboBox.Text);

0 commit comments

Comments
 (0)