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 openToolStripMenuItem_Click(object sender, EventArgs e) { Coloring.counter = 0; MenuItemEvents.OpenFile(); if (Coloring.counter == 0) { Coloring.DoFirstColoring(); } }
private void NrichTextBox_TextChanged(object sender, EventArgs e) { Coloring.DoColoring(); if (NrichTextBox.Text == "") { AddLineNumbers(); } }
public static void Init(RichTextBox editor, RichTextBox errorLog, ListBox suggestionBox) { Utility.Init(editor, errorLog, suggestionBox); KeyEventsHandler.Init(editor, errorLog, suggestionBox); TokenGenerator.InitBox(editor); Highlighter.Init(editor); SuggestionProvider.InitSuggestionProvider(new List <string>(), suggestionBox, editor); Coloring.InitColoring(editor); Helper.Init(); MenuItemEvents.Init(editor); }