public MotionCaptureTest() { _textView = CreateTextView(); var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); _incrementalSearch = new IncrementalSearch( vimBufferData, CommonOperationsFactory.GetCommonOperations(vimBufferData)); _localSettings = vimTextBuffer.LocalSettings; _captureRaw = new MotionCapture( vimBufferData, _incrementalSearch); _capture = _captureRaw; }
private void Create(params string[] lines) { _vimHost = (MockVimHost)Vim.VimHost; _textView = CreateTextView(lines); _globalSettings = Vim.GlobalSettings; _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); _factory = new MockRepository(MockBehavior.Strict); _statusUtil = _factory.Create<IStatusUtil>(); _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchBackwardWrapped)); _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchForwardWrapped)); _vimData = Vim.VimData; var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData); _searchRaw = new IncrementalSearch(vimBufferData, operations); _search = _searchRaw; }
private void Create(params string[] lines) { _textView = CreateTextView(lines); _vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); _registerMap = Vim.RegisterMap; var vimBufferData = CreateVimBufferData( _vimTextBuffer, _textView); _commandUtil = VimUtil.CreateCommandUtil(vimBufferData); var motionCapture = VimUtil.CreateMotionCapture(vimBufferData); _runnerRaw = new CommandRunner( _textView, _registerMap, motionCapture, _commandUtil, new StatusUtil(), VisualKind.Character); _runner = _runnerRaw; }
private void Create(KeyRemapMode countKeyRemapMode, params string[] lines) { _textView = CreateTextView(lines); _vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); _registerMap = Vim.RegisterMap; var vimBufferData = CreateVimBufferData( _vimTextBuffer, _textView); _commandUtil = CreateCommandUtil(vimBufferData); var incrementalSearch = new IncrementalSearch( vimBufferData, CommonOperationsFactory.GetCommonOperations(vimBufferData)); var motionCapture = new MotionCapture(vimBufferData, incrementalSearch); _runnerRaw = new CommandRunner( vimBufferData, motionCapture, _commandUtil, VisualKind.Character, countKeyRemapMode); _runner = _runnerRaw; }
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)); var runner = new CommandRunner( _textView, Vim.RegisterMap, capture, vimBufferData.LocalSettings, _commandUtil.Object, (new Mock <IStatusUtil>()).Object, VisualKind.Character, KeyRemapMode.Visual); _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, visualKind, runner, capture, _tracker.Object); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); }
/// <summary> /// Create an IVimTextBuffer instance with the given lines /// </summary> protected IVimTextBuffer CreateVimTextBuffer(params string[] lines) { var textBuffer = CreateTextBuffer(lines); return(Vim.CreateVimTextBuffer(textBuffer)); }