protected void Create(params string[] lines)
        {
            _vimHost = (MockVimHost)Vim.VimHost;
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            _localSettings = _vimTextBuffer.LocalSettings;

            var foldManager = CreateFoldManager(_textView);

            _factory = new MockRepository(MockBehavior.Loose);
            _statusUtil = _factory.Create<IStatusUtil>();
            _bulkOperations = new TestableBulkOperations();

            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView,
                statusUtil: _statusUtil.Object);
            _jumpList = vimBufferData.JumpList;
            _windowSettings = vimBufferData.WindowSettings;

            _vimData = Vim.VimData;
            _macroRecorder = Vim.MacroRecorder;
            _globalSettings = Vim.GlobalSettings;

            var operations = CreateCommonOperations(vimBufferData);
            _motionUtil = new MotionUtil(vimBufferData, operations);
            _commandUtil = new CommandUtil(
                vimBufferData,
                _motionUtil,
                operations,
                foldManager,
                new InsertUtil(vimBufferData, operations),
                _bulkOperations);
        }
 public void Create(params string[] lines)
 {
     _vimBuffer = CreateVimBuffer(lines);
     _vimBuffer.StatusMessage += (sender, args) => { _lastStatus = args.Message; };
     _textView = _vimBuffer.TextView;
     _textBuffer = _textView.TextBuffer;
     _vimHost = VimHost;
 }
 public void CreateBuffer(params string[] lines)
 {
     var tuple = EditorUtil.CreateViewAndOperations(lines);
     view = tuple.Item1;
     host = new MockVimHost();
     var service = EditorUtil.FactoryService;
     buffer = service.vim.CreateBuffer(view);
     host = (MockVimHost)service.vim.VimHost;
 }
        public void Create(params string[] lines)
        {
            var tuple = EditorUtil.CreateTextViewAndEditorOperations(lines);
            _textView = tuple.Item1;
            _host = new MockVimHost();

            var service = EditorUtil.FactoryService;
            _buffer = service.Vim.CreateVimBuffer(_textView);
            _host = (MockVimHost)service.Vim.VimHost;
        }
        protected virtual void Create(params string[] lines)
        {
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vimBuffer = Vim.CreateVimBuffer(_textView);
            _vimBuffer.ErrorMessage +=
                (_, message) =>
                {
                    if (_assertOnErrorMessage)
                    {
                        throw new Exception("Error Message: " + message.Message);
                    }
                };
            _vimBuffer.WarningMessage +=
                (_, message) =>
                {
                    if (_assertOnWarningMessage)
                    {
                        throw new Exception("Warning Message: " + message.Message);
                    }
                };
            _vimBufferData = _vimBuffer.VimBufferData;
            _vimTextBuffer = _vimBuffer.VimTextBuffer;
            _normalMode = _vimBuffer.NormalMode;
            _keyMap = _vimBuffer.Vim.KeyMap;
            _localSettings = _vimBuffer.LocalSettings;
            _globalSettings = _localSettings.GlobalSettings;
            _windowSettings = _vimBuffer.WindowSettings;
            _jumpList = _vimBuffer.JumpList;
            _vimHost = (MockVimHost)_vimBuffer.Vim.VimHost;
            _vimHost.BeepCount = 0;
            _vimData = Vim.VimData;
            _foldManager = FoldManagerFactory.GetFoldManager(_textView);
            _clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue<IClipboardDevice>();

            // Many of the operations operate on both the visual and edit / text snapshot
            // simultaneously.  Ensure that our setup code is producing a proper IElisionSnapshot
            // for the Visual portion so we can root out any bad mixing of instances between
            // the two
            Assert.True(_textView.VisualSnapshot is IElisionSnapshot);
            Assert.True(_textView.VisualSnapshot != _textView.TextSnapshot);
        }
Beispiel #6
0
        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;
        }
        public void Create(params string[] lines)
        {
            var tuple = EditorUtil.CreateTextViewAndEditorOperations(lines);
            _textView = tuple.Item1;
            _textBuffer = _textView.TextBuffer;
            var service = EditorUtil.FactoryService;
            _vimBuffer = service.Vim.CreateVimBuffer(_textView);
            _vimBuffer.ErrorMessage +=
                (_, message) =>
                {
                    if (_assertOnErrorMessage)
                    {
                        Assert.Fail("Error Message: " + message);
                    }
                };
            _vimBuffer.WarningMessage +=
                (_, message) =>
                {
                    if (_assertOnWarningMessage)
                    {
                        Assert.Fail("Warning Message: " + message);
                    }
                };
            _vimTextBuffer = _vimBuffer.VimTextBuffer;
            _keyMap = _vimBuffer.Vim.KeyMap;
            _globalSettings = _vimBuffer.LocalSettings.GlobalSettings;
            _jumpList = _vimBuffer.JumpList;
            _vimHost = (MockVimHost)_vimBuffer.Vim.VimHost;
            _vimHost.BeepCount = 0;
            _vimData = service.Vim.VimData;
            _foldManager = EditorUtil.FactoryService.FoldManagerFactory.GetFoldManager(_textView);

            // Many of the operations operate on both the visual and edit / text snapshot
            // simultaneously.  Ensure that our setup code is producing a proper IElisionSnapshot
            // for the Visual portion so we can root out any bad mixing of instances between
            // the two
            Assert.IsTrue(_textView.VisualSnapshot is IElisionSnapshot);
            Assert.IsTrue(_textView.VisualSnapshot != _textView.TextSnapshot);
        }
Beispiel #8
0
        private void Create(params string[] lines)
        {
            _vimHost = (MockVimHost)Vim.VimHost;
            _textView = CreateTextView(lines);
            _textBuffer = _textView.TextBuffer;
            _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
            _localSettings = _vimTextBuffer.LocalSettings;

            _foldManager = FoldManagerFactory.GetFoldManager(_textView);

            _factory = new MockRepository(MockBehavior.Loose);
            _statusUtil = _factory.Create<IStatusUtil>();
            _smartIdentationService = _factory.Create<ISmartIndentationService>();

            var vimBufferData = CreateVimBufferData(
                _vimTextBuffer,
                _textView,
                statusUtil: _statusUtil.Object);
            _jumpList = vimBufferData.JumpList;
            _windowSettings = vimBufferData.WindowSettings;

            _vimData = Vim.VimData;
            _macroRecorder = Vim.MacroRecorder;
            _registerMap = Vim.RegisterMap;
            _globalSettings = Vim.GlobalSettings;

            var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
            _motionUtil = new MotionUtil(vimBufferData);
            _commandUtil = new CommandUtil(
                vimBufferData,
                _motionUtil,
                operations,
                _smartIdentationService.Object,
                _foldManager,
                new InsertUtil(vimBufferData, operations));
        }