public static void SuggestionKeyHandler(KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: string textToInsert = SuggestionProvider.GetItem(); int lastWordLength = Utility.GetLastWord().Length; string textToAppend = textToInsert.Substring(lastWordLength); int select = editor.SelectionStart; Utility.AppendText(editor, Coloring.GetColor(textToInsert), textToAppend); editor.SelectionStart = select + textToAppend.Length; Coloring.DoColoring(); Utility.AppendText(editor, Color.Black, " "); editor.SelectionStart = editor.SelectionStart + 1; Utility.ClearSuggestionList(); Utility.FocusEditor(); break; case Keys.Escape: Utility.ClearSuggestionList(); Utility.FocusEditor(); break; default: break; } }
private void NrichTextBox_TextChanged(object sender, EventArgs e) { Coloring.DoColoring(); if (NrichTextBox.Text == "") { AddLineNumbers(); } }