public void DoSpecialKey(Keys modifier, Keys key)
        {
            Debug.WriteLineIf(DebugOpt.IntelliSense, "DoSpecial " + key.ToString());
            if (modifier == Keys.Control && key == Keys.S)
            {
                _context.SortStyle = _context.SortStyle == IntelliSenseSort.Alphabet? IntelliSenseSort.Historical : IntelliSenseSort.Alphabet;
                string t = _listBox.SelectedIndexEx == -1? null : _listBox.Items[_listBox.SelectedIndexEx].ToString();
                _context.BuildCandidates();
                PopupAgain();
                _listBox.SelectedIndexEx = t == null? -1 : _listBox.FindStringExact(t);
            }
            else if (key == Keys.Delete) //項目削除
            {
                if (_listBox.SelectedIndex == -1)
                {
                    return;
                }

                string   t                     = _listBox.Items[_listBox.SelectedIndex].ToString();
                string[] full_command          = _context.ConcatToCurrentInput(_context.CurrentScheme.ParseCommandInput(t));
                IntelliSenseItemCollection col = (IntelliSenseItemCollection)_context.CurrentScheme.CommandHistory.GetAdapter(typeof(IntelliSenseItemCollection));
                col.RemoveItem(full_command);

                _listBox.Items.RemoveAt(_listBox.SelectedIndex);
            }
        }
Пример #2
0
 public GenericShellScheme(string name, string prompt)
 {
     _name                       = name;
     _promptExpression           = prompt;
     _backSpaceChar              = (char)0x08;
     _buffer                     = new StringBuilder();
     _commandList                = "";
     _intelliSenseItemCollection = new IntelliSenseItemCollection();
 }
Пример #3
0
 public GenericShellScheme(string name, string prompt)
 {
     _name = name;
     _promptExpression = prompt;
     _backSpaceChar = (char)0x08;
     _buffer = new StringBuilder();
     _commandList = "";
     _intelliSenseItemCollection = new IntelliSenseItemCollection();
 }
Пример #4
0
        public IntelliSenseItemCollection Clone()
        {
            IntelliSenseItemCollection t = new IntelliSenseItemCollection();

            foreach (IIntelliSenseItem item in _items)
            {
                t._items.AddLast(item.Clone());
            }
            return(t);
        }
Пример #5
0
        private void CommandListOne(string input, params string[] expected)
        {
            GenericShellScheme g = new GenericShellScheme("generic", "");

            g.SetCommandList(input);
            IntelliSenseItemCollection col = (IntelliSenseItemCollection)g.CommandHistory;

            Confirm(col.ToStringArray(), expected);
            Assert.AreEqual(input, g.FormatCommandList()); //再フォーマット
        }
Пример #6
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);
            }
        }
Пример #7
0
 public IntelliSenseItemCollection Clone() {
     IntelliSenseItemCollection t = new IntelliSenseItemCollection();
     foreach (IIntelliSenseItem item in _items)
         t._items.AddLast(item.Clone());
     return t;
 }