Пример #1
0
        private void Create2(
            ModeKind kind = ModeKind.VisualCharacter,
            params string[] lines)
        {
            _textView   = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
            var visualKind    = VisualKind.OfModeKind(kind).Value;

            _selection = _textView.Selection;
            _factory   = new MockRepository(MockBehavior.Strict);
            _tracker   = _factory.Create <ISelectionTracker>();
            _tracker.Setup(x => x.Start());
            _tracker.Setup(x => x.UpdateSelection());
            _tracker.Setup(x => x.RecordCaretTrackingPoint(It.IsAny <ModeArgument>()));
            _tracker.SetupGet(x => x.IsRunning).Returns(true);
            _operations = _factory.Create <ICommonOperations>();
            _operations.SetupGet(x => x.TextView).Returns(_textView);
            _operations.Setup(x => x.MoveCaretToPoint(It.IsAny <SnapshotPoint>(), ViewFlags.Standard));
            _commandUtil = _factory.Create <ICommandUtil>();
            var motionUtil = new MotionUtil(vimBufferData, _operations.Object);
            var capture    = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object, motionUtil));
            var runner     = new CommandRunner(
                vimBufferData,
                capture,
                _commandUtil.Object,
                VisualKind.Character,
                KeyRemapMode.Visual);

            _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, visualKind, runner, capture, _tracker.Object);
            _mode    = _modeRaw;
            _mode.OnEnter(ModeArgument.None);
        }