private void Editor_CharAdded(object sender, ScintillaNet.CharAddedEventArgs e) { ScintillaNet.Scintilla Editor = sender as ScintillaNet.Scintilla; curWord = Editor.GetWordFromPosition(Editor.Selection.Start); if (curWord.Length == 0) { return; } Predicate <string> startWord = compareWithCurrentWord; List <string> list = autoCompleteList.FindAll(startWord); if (list.Count > 0) { Editor.AutoComplete.Show(curWord.Length, string.Join(SciEditor.AutoComplete.ListSeparator.ToString(), list.ToArray())); } }
void CodeEditor_CharAdded(object sender, ScintillaNet.CharAddedEventArgs e) { // Check the last non-space character. int lci = this.Selection.Start - 1; char lc = this.Text[lci]; while (lci >= 0) { if (lc != ' ' && lc != '\t' && lc != '\n' && lc != '\r') { break; } lc = this.Text[lci]; lci -= 1; } if (lci == -1) { return; } if (lc == '.') { // Scan back. int b = this.Selection.Start - 1; int i = b; string s = ""; char c = this.Text[i]; while (true) { if (c != '.' && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) { break; } if (c == '.') { s = s.Insert(0, this.Text.Substring(i + 1, b - i)); b = i; } i -= 1; c = this.Text[i]; } if (b != i) { s = s.Insert(0, this.Text.Substring(i + 1, b - i)); b = i; } if (s.Length == 0) { return; } else { s = s.Substring(0, s.Length - 1); } this.AutoComplete.List = Central.Manager.CacheManager.AutoComplete.GetList(s); //this.AutoComplete.Show(); } else if (lc == '=') { // Show global list. this.AutoComplete.List = Central.Manager.CacheManager.AutoComplete.GetList(null); //this.AutoComplete.Show(); } }