ScintillaNET
ScintillaNET copied to clipboard
Custom Autocompletion Not Working As Desired
I'm trying to get the auto complete to use a list of lines that start with (#:#) with the # being numbers, and a line with text would follow that. However it only shows after (#:# is typed in, and doesn't active for the (, #, or the :. So typing (#: autocomplete doesn't activate, but (#:# does activate it.
private void textBox1_Charadd(object sender, EventArgs e)
{
var currentPos = textBox1.CurrentPosition;
var lineStart = textBox1.Lines[textBox1.CurrentLine].Position;
string autoCSearch = textBox1.GetTextRange(lineStart, currentPos - lineStart);
acList.Clear();
// Line Start Prefix Search
if (autoCSearch.Contains("("))
{
var codeStart = autoCSearch.IndexOf('(');
autoCSearch = autoCSearch.Remove(0, codeStart);
var lenEntered = autoCSearch.Length;
// File Exists = True
if (System.IO.File.Exists("data\\lines\\all.txt"))
{
System.IO.StreamReader autoCBuild;
autoCBuild = new System.IO.StreamReader("data\\lines\\all.txt");
string constructSource;
while ((constructSource = autoCBuild.ReadLine()) != null)
{
// Add to List
string sourceContains = constructSource.ToUpper();
string acSearchContains = autoCSearch.ToUpper();
if (sourceContains.Contains(acSearchContains))
{
constructSource = constructSource + ";" + Environment.NewLine;
acList.Text = acList.Text + constructSource;
}
}
// Show
textBox1.AutoCShow(lenEntered, acList.Text);
}
}
}
Example 1: http://prntscr.com/mvvicd Example 2: http://prntscr.com/mvvlsm
Nevermind, I actually got the solution myself, it wasn't actually Scintilla. My bad on that part.
Nevermind, I actually got the solution myself, it wasn't actually Scintilla. My bad on that part.
How did you work it out?