Exemple #1
0
 public IntelliSenseItem(string[] text, int startIndex, IntelliSenseItem original)
 {
     _text         = text;
     _startIndex   = startIndex;
     _originalItem = original;
     Debug.Assert(text.Length >= _startIndex);
 }
Exemple #2
0
 public IntelliSenseItem(string[] text, int startIndex, IntelliSenseItem original)
 {
     _text = text;
     _startIndex = startIndex;
     _originalItem = original;
     Debug.Assert(text.Length >= _startIndex);
 }
 public IIntelliSenseItem FindItem(string[] command) {
     IntelliSenseItem newitem = new IntelliSenseItem(command);
     LinkedList<IIntelliSenseItem>.Enumerator e = _items.GetEnumerator();
     while (e.MoveNext()) {
         IntelliSenseItem item = e.Current as IntelliSenseItem;
         if (item.CompareTo(newitem) == 0)
             return item;
     }
     return null;
 }
 public void RemoveItem(string[] command) {
     IntelliSenseItem newitem = new IntelliSenseItem(command);
     LinkedList<IIntelliSenseItem>.Enumerator e = _items.GetEnumerator();
     while (e.MoveNext()) {
         IntelliSenseItem item = e.Current as IntelliSenseItem;
         if (item.CompareTo(newitem) == 0) {
             _items.Remove(item);
             Debug.WriteLineIf(DebugOpt.IntelliSense, "Removed " + newitem.Format(' '));
             break;
         }
     }
 }
Exemple #5
0
        public void BuildCandidates()
        {
            _candidates.Clear();
            _initialSelectedIndex = -1;
            IntelliSenseItem           initial = null;
            IntelliSenseItemCollection col     = (IntelliSenseItemCollection)_scheme.CommandHistory.GetAdapter(typeof(IntelliSenseItemCollection));

            foreach (IntelliSenseItem item in col.Items)
            {
                IntelliSenseItem.MatchForwardResult r = item.MatchForward(_currentInput);
                if (_intelliSenseMode == IntelliSenseMode.ArgComplement && r == IntelliSenseItem.MatchForwardResult.PartialArg)
                {
                    _candidates.AddItem(new IntelliSenseItem(item.Text, _currentInput.Length, item));
                }
                else if (_intelliSenseMode == IntelliSenseMode.CharComplement && r == IntelliSenseItem.MatchForwardResult.PartialChar)
                {
                    IntelliSenseItem i = new IntelliSenseItem(item.Text, _currentInput.Length - 1, item);
                    if (initial == null)
                    {
                        initial = i; //Partialの一致がきた最初のものを初期値とする
                    }
                    _candidates.AddItem(i);
                }
            }

            //外部に調節の機会を与える
            IIntelliSenseCandidateExtension[] extensions = TerminalEmulatorPlugin.Instance.IntelliSenseExtensions;
            if (extensions.Length > 0)
            {
                foreach (IIntelliSenseCandidateExtension e in extensions)
                {
                    e.AdjustItem(_owner.Terminal, _candidates, _currentInput);
                }
            }

            if (_sortStyle == IntelliSenseSort.Alphabet)
            {
                _candidates.Sort();
            }

            if (initial == null && _candidates.Count > 0)
            {
                _initialSelectedIndex = 0; //仕方なくこれを選ぶ
            }
            else
            {
                _initialSelectedIndex = _candidates.IndexOf(initial);
            }
        }
Exemple #6
0
        public IIntelliSenseItem FindItem(string[] command)
        {
            IntelliSenseItem newitem = new IntelliSenseItem(command);

            LinkedList <IIntelliSenseItem> .Enumerator e = _items.GetEnumerator();
            while (e.MoveNext())
            {
                IntelliSenseItem item = e.Current as IntelliSenseItem;
                if (item.CompareTo(newitem) == 0)
                {
                    return(item);
                }
            }
            return(null);
        }
Exemple #7
0
        public void RemoveItem(string[] command)
        {
            IntelliSenseItem newitem = new IntelliSenseItem(command);

            LinkedList <IIntelliSenseItem> .Enumerator e = _items.GetEnumerator();
            while (e.MoveNext())
            {
                IntelliSenseItem item = e.Current as IntelliSenseItem;
                if (item.CompareTo(newitem) == 0)
                {
                    _items.Remove(item);
                    Debug.WriteLineIf(DebugOpt.IntelliSense, "Removed " + newitem.Format(' '));
                    break;
                }
            }
        }
        public void UpdateItem(string[] command) {

            IntelliSenseItem newitem = new IntelliSenseItem(command);
            LinkedList<IIntelliSenseItem>.Enumerator e = _items.GetEnumerator();
            while (e.MoveNext()) {
                IntelliSenseItem item = e.Current as IntelliSenseItem;
                if (item.CompareTo(newitem) == 0) {
                    //先頭に持ってきてリターン
                    _items.Remove(item);
                    _items.AddFirst(newitem);
                    return;
                }
            }

            _items.AddFirst(newitem);
            if (_items.Count > TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions.ShellHistoryLimitCount)
                _items.RemoveLast();
        }
Exemple #9
0
        public int CompareTo(object other0)
        {
            IntelliSenseItem other = other0 as IntelliSenseItem;

            Debug.Assert(other != null);
            int ml = Math.Min(this.Length, other.Length);

            for (int i = 0; i < ml; i++)
            {
                string this_  = _text[_startIndex + i];
                string other_ = other._text[other._startIndex + i];
                int    r      = this_.CompareTo(other_);
                if (r != 0)
                {
                    return(r);
                }
            }

            return(this.Length - other.Length); //長いほうが後
        }
Exemple #10
0
        public void UpdateItem(string[] command)
        {
            IntelliSenseItem newitem = new IntelliSenseItem(command);

            LinkedList <IIntelliSenseItem> .Enumerator e = _items.GetEnumerator();
            while (e.MoveNext())
            {
                IntelliSenseItem item = e.Current as IntelliSenseItem;
                if (item.CompareTo(newitem) == 0)
                {
                    //先頭に持ってきてリターン
                    _items.Remove(item);
                    _items.AddFirst(newitem);
                    return;
                }
            }

            _items.AddFirst(newitem);
            if (_items.Count > TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions.ShellHistoryLimitCount)
            {
                _items.RemoveLast();
            }
        }