示例#1
0
        public void CanProcess_TextInput()
        {
            Assert.IsTrue(_mode.CanProcess(KeyInputUtil.EnterKey));
            Assert.IsTrue(_mode.IsTextInput(KeyInputUtil.EnterKey));
            Assert.IsTrue(_mode.CanProcess(KeyInputUtil.AlternateEnterKey));
            Assert.IsTrue(_mode.IsTextInput(KeyInputUtil.AlternateEnterKey));

            foreach (var cur in KeyInputUtilTest.CharsAll)
            {
                var input = KeyInputUtil.CharToKeyInput(cur);
                Assert.IsTrue(_mode.CanProcess(input));
                Assert.IsTrue(_mode.IsTextInput(input));
            }
        }
示例#2
0
        /// <summary>
        /// Determine if the IInsertMode value should process the given KeyInput
        /// </summary>
        private bool CanProcessDirectly(IInsertMode mode, KeyInput keyInput)
        {
            // Don't let the mode directly process anything it considers text input.  We need this to go
            // through IOleCommandTarget in order to get InsertMode values.
            if (mode.IsTextInput(keyInput))
            {
                return(false);
            }

            var isAnyArrow =
                keyInput.Key == VimKey.Up ||
                keyInput.Key == VimKey.Down ||
                keyInput.Key == VimKey.Left ||
                keyInput.Key == VimKey.Right;

            // If this is any of the arrow keys and one of the help windows is active then don't
            // let insert mode process the input.  We want the KeyInput to be routed to the windows
            // like Intellisense so navigation can occur
            if (isAnyArrow && (_broker.IsCompletionActive || _broker.IsQuickInfoActive || _broker.IsSignatureHelpActive || _broker.IsSmartTagSessionActive))
            {
                return(false);
            }

            // Unfortunately there is no way to detect if the R# completion windows are active.  We have
            // to take the pessimistic view that they are not and just not handle the input
            if (isAnyArrow && _externalEditManager.IsResharperLoaded)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        /// <summary>
        /// Determine if the IInsertMode value should process the given KeyInput
        /// </summary>
        private bool CanProcessDirectly(IInsertMode mode, KeyInput keyInput)
        {
            // Don't let the mode directly process anything it considers text input.  We need this to go
            // through IOleCommandTarget in order to get InsertMode values.
            if (mode.IsTextInput(keyInput))
            {
                return false;
            }

            var isAnyArrow =
                keyInput.Key == VimKey.Up ||
                keyInput.Key == VimKey.Down ||
                keyInput.Key == VimKey.Left ||
                keyInput.Key == VimKey.Right;

            // If this is any of the arrow keys and one of the help windows is active then don't
            // let insert mode process the input.  We want the KeyInput to be routed to the windows
            // like Intellisense so navigation can occur
            if (isAnyArrow && (_broker.IsCompletionActive || _broker.IsQuickInfoActive || _broker.IsSignatureHelpActive || _broker.IsSmartTagSessionActive))
            {
                return false;
            }

            // Unfortunately there is no way to detect if the R# completion windows are active.  We have
            // to take the pessimistic view that they are not and just not handle the input
            if (isAnyArrow && _externalEditManager.IsResharperLoaded)
            {
                return false;
            }

            return true;
        }