예제 #1
0
        //TerminalControlから来るやつ
        public bool ProcessKey(Keys modifiers, Keys keybody)
        {
            if (TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions.IntelliSenseKey == (modifiers | keybody))
            {
                if (CanPopupIntelliSense())
                {
                    PopupMain('\0');
                    return(true);
                }
            }
            else if (modifiers == Keys.None && keybody == Keys.Enter)   //コマンド入力とリストの更新
            {
                _cancelLockFlag = false;
                //Enter前にはプロンプト認識を必ず更新
                _terminal.PromptRecognizer.CheckIfUpdated();
                if (_currentCommand != null && _currentCommand.Length > 0)
                {
                    _context.UpdateCommandList(_currentCommand);
                }
                else   //複数行きたときの場合を救済。さすがに使い勝手は悪いだろう
                {
                    TryParseMultiLineCommand();
                }
            }

            return(false);
        }
        public void DoChar(char ch)
        {
            Debug.WriteLineIf(DebugOpt.IntelliSense, "DoChar " + (int)ch);
            if (_context.CurrentScheme.IsDelimiter(ch))  //本当はここでクオーテーション等コマンドパース中のコンテキストによって単語終端を判定したい
            {
                if (_listBox.SelectedIndexEx != -1)
                {
                    PartialComplement(ch);
                    return;
                }
            }

            //SendBack()の反応が来る前に補完を試みることに備えて
            _context.CharQueue.LockedPushChar(ch);
            SendBack(ch);

            if (ch == (char)0x08) //BS
            {
                if (_context.RemoveChar().Length == 0)
                {
                    Cancel();
                }
            }
            if (ch == '\n') //Enter このときはTerminalControlのキーイベントを経由しないので
            {
                _context.UpdateCommandList(_context.Owner.WholeCommand);
            }
            else if (0x20 <= (int)ch && (int)ch <= 0x7E) //printableなやつ限定
            {
                string current = _context.AppendChar(ch);
                int    i       = FindCandidateIndex(current);
                if (_context.CurrentScheme.IsDelimiter(ch) && i == -1)
                {
                    Cancel();
                }
                else
                {
                    _listBox.SelectedIndexEx = i;
                }
            }
        }