예제 #1
0
        void scintilla_CharAdded(object sender, CharAddedEventArgs e)
        {
            if (this.IsActive)
            {
                int le = getLengthEntered();

                // We need to make sure we aren't affecting the main list later on.
                // and so we create a new SkipList from the one we're given.
                SkipList      usableList = new SkipList(_list.GetList());
                StringBuilder strb       = new StringBuilder();
                int           cop        = 1;
                while (le > (cop - 1))
                {
                    strb.Append(NativeScintilla.GetCharAt(NativeScintilla.GetCurrentPos() - cop));
                    cop++;
                }
                char[] arr = strb.ToString().ToCharArray();
                Array.Reverse(arr);
                String   tmp    = new string(arr);
                SkipList srList = usableList.RemoveNonMatchingStartString(tmp);
                String   rList  = getListString(srList);
                NativeScintilla.AutoCSetCurList(rList);
            }
            else
            {
                if (this.List[0] != "")
                {
                    if (ShouldTrigger(e.Ch))
                    {
                        this.Show();
                    }
                }
            }
        }
예제 #2
0
        void scintilla_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.IsActive)
            {
                if (e.KeyData == Keys.Back)
                {
                    int le = getLengthEntered();

                    if (le > 0)
                    {
                        // We need to make sure we aren't affecting the main list later on.
                        // and so we create a new SkipList from the one we're given.
                        SkipList      usableList = new SkipList(_list.GetList());
                        StringBuilder strb       = new StringBuilder();
                        int           cop        = 1;
                        while (le > (cop - 1))
                        {
                            strb.Append(NativeScintilla.GetCharAt(NativeScintilla.GetCurrentPos() - (cop + 1)));
                            cop++;
                        }
                        char[] arr = strb.ToString().ToCharArray();
                        Array.Reverse(arr);
                        String   tmp    = new string(arr);
                        SkipList srList = usableList.RemoveNonMatchingStartString(tmp.Substring(1));
                        String   rList  = getListString(srList);
                        NativeScintilla.AutoCSetCurList(rList);
                    }
                }
            }
        }