ScintillaNET icon indicating copy to clipboard operation
ScintillaNET copied to clipboard

Custom Autocompletion Not Working As Desired

Open justinbittner11 opened this issue 6 years ago • 2 comments

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

justinbittner11 avatar Mar 10 '19 05:03 justinbittner11

Nevermind, I actually got the solution myself, it wasn't actually Scintilla. My bad on that part.

justinbittner11 avatar Mar 10 '19 13:03 justinbittner11

Nevermind, I actually got the solution myself, it wasn't actually Scintilla. My bad on that part.

How did you work it out?

pluveto avatar May 20 '20 07:05 pluveto