private void _KeyDown(object sender, KeyEventArgs e)
{
string allowedChars = "([{}]);,. ";
int currentLine = textBox.Selection.Bounds.iStartLine;
string textTillCursor = textBox.GetLineText(currentLine).Substring(0, textBox.Selection.Bounds.iStartChar);
//string textAfterCursor = tbEditor.GetLineText(currentLine);
char charBeforeCursor = textBox.Selection.CharBeforeStart;
char charAfterCursor = textBox.Selection.CharAfterStart;
if (e.KeyData == (Keys.K | Keys.Control))
{
//forced show (MinFragmentLength will be ignored)
autocomplete.Show(true);
//e.Handled = true;
}
if (System.Char.IsLetter((char)e.KeyValue) //warning, lisp programmer at work
&& textTillCursor.Count() > 0
&& allowedChars.Contains(charBeforeCursor)
&& allowedChars.Contains(charAfterCursor))
/*&& cursorIsNotInsideFunctionName
&& cursorIsCorrectlyIndented?? perhaps difficult with regex since parsing a language ain't easy
*/
{
autocomplete.Show(true);
}
UpdateAutocompleteIdentifiers();
}