Exemplo n.º 1
0
		/// <summary>
		/// Shows the autocomplete window
		/// </summary>
		/// <param name="list">Sets the <see cref="List"/> property. </param>
		/// In this overload the lengthEntered is automatically detected by the editor.
		public void Show(IEnumerable<string> list)
		{
            _list = new SkipList(list);
			Show(-1);
		}
Exemplo n.º 2
0
 internal void Show(int lengthEntered, string list, bool dontSplit)
 {
     SkipList submittableList = new SkipList(list.Split(ListSeparator));
     Show(lengthEntered, submittableList, dontSplit);
 }
Exemplo n.º 3
0
		/// <summary>
		/// Shows the autocomplete window
		/// </summary>
		/// <param name="lengthEntered">Number of characters of the current word already entered in the editor </param>
		/// <param name="list">Sets the <see cref="List"/> property. </param>
		public void Show(int lengthEntered, IEnumerable<string> list)
		{
            _list = new SkipList(list);
			Show(-1);
		}
Exemplo n.º 4
0
        internal void Show(int lengthEntered, SkipList list, bool dontSplit)
        {
            //	We may have the auto-detect of lengthEntered. In which case
            //	look for the last word character as the start
            int le = lengthEntered;
            if (le < 0)
                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++;
            }
            SkipList srList = usableList.RemoveNonMatchingStartString(strb.ToString());
            String rList = getListString(srList);
            NativeScintilla.AutoCShow(le, rList);

            //	Now it may have been that the auto-detect lengthEntered
            //	caused to AutoCShow call to fail becuase no words matched
            //	the letters we autodetected. In this case just show the
            //	list with a 0 lengthEntered to make sure it will show
            if (!IsActive && lengthEntered < 0)
                NativeScintilla.AutoCShow(0, rList);
        }
Exemplo n.º 5
0
        /// <summary>
		/// Shows the autocomplete window.
		/// </summary>
		/// <param name="lengthEntered">Number of characters of the current word already entered in the editor </param>
		/// <param name="list">Sets the <see cref="ListString"/> property. </param>
		public void Show(int lengthEntered, string list)
		{
			if (list == string.Empty)
                _list = new SkipList();
			else
                _list = new SkipList(list.Split(ListSeparator));
			Show(lengthEntered, list, true);
		}
Exemplo n.º 6
0
        private string getListString(SkipList list)
        {
            StringBuilder listString = new StringBuilder();
            foreach (string s in list)
            {
                listString.Append(s).Append(" ");
            }
            if (listString.Length > 1)
                listString.Remove(listString.Length - 1, 1);

            return listString.ToString().Trim();
        }
Exemplo n.º 7
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();
                    }
                }
            }
        }
Exemplo n.º 8
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);
                    }
                }
            }
        }