protected ScrollOffsetTest() { Create(s_lines); _lastLineNumber = _textBuffer.CurrentSnapshot.LineCount - 1; _textView.SetVisibleLineCount(5); _foldManager = FoldManagerFactory.GetFoldManager(_textView); }
protected void Create(params string[] lines) { _statusUtil = new TestableStatusUtil(); _vimData = Vim.VimData; _vimBufferData = CreateVimBufferData( CreateTextView(lines), statusUtil: _statusUtil); _vimBuffer = CreateVimBuffer(_vimBufferData); _vimTextBuffer = _vimBufferData.VimTextBuffer; _localSettings = _vimBufferData.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _textBuffer = _vimBufferData.TextBuffer; _textView = _vimBufferData.TextView; _interpreter = new global::Vim.Interpreter.Interpreter( _vimBuffer, CommonOperationsFactory.GetCommonOperations(_vimBufferData), FoldManagerFactory.GetFoldManager(_vimBufferData.TextView), new FileSystem(), BufferTrackingService); _keyMap = Vim.KeyMap; }
public void SpecialMarksAreSet() { var s_emptyList = FSharpList <Mark> .Empty; OpenFakeVimBufferTestWindow(""); var interpreter = new VimInterpreter( _vimBuffer, CommonOperationsFactory.GetCommonOperations(_vimBufferData), FoldManagerFactory.GetFoldManager(_vimBufferData.TextView), new FileSystem(), BufferTrackingService); _vimBuffer.ProcessNotation("<ESC>i1<CR>2<CR>3<CR>4<CR>5<CR>6<CR>7<CR>8<CR>9<CR>0<ESC>"); interpreter.RunDisplayMarks(s_emptyList); var expectedMarks = new[] { @"mark line col file/text", @" ' 1 0 VimBufferTest.cs", @" "" 1 0 VimBufferTest.cs", //@" [ 1 0 VimBufferTest.cs", //@" ] 10 1 VimBufferTest.cs", @" ^ 10 1 VimBufferTest.cs", @" . 10 0 VimBufferTest.cs", }; Assert.Equal(string.Join(Environment.NewLine, expectedMarks), _statusUtil.LastStatus); // set an upper and lower mark _vimBuffer.ProcessNotation("kmzkmZ"); _vimBuffer.ProcessNotation("1G"); interpreter.RunDisplayMarks(s_emptyList); expectedMarks = new[] { @"mark line col file/text", @" ' 8 0 VimBufferTest.cs", @" z 9 0 VimBufferTest.cs", @" Z 8 0 VimBufferTest.cs", @" "" 1 0 VimBufferTest.cs", //@" [ 1 0 VimBufferTest.cs", //@" ] 10 1 VimBufferTest.cs", @" ^ 10 1 VimBufferTest.cs", @" . 10 0 VimBufferTest.cs", }; Assert.Equal(string.Join(Environment.NewLine, expectedMarks), _statusUtil.LastStatus); _vimBuffer.ProcessNotation("yy"); interpreter.RunDisplayMarks(s_emptyList); expectedMarks = new[] { @"mark line col file/text", @" ' 8 0 VimBufferTest.cs", @" z 9 0 VimBufferTest.cs", @" Z 8 0 VimBufferTest.cs", @" "" 1 0 VimBufferTest.cs", //@" [ 1 0 VimBufferTest.cs", //@" ] 10 1 VimBufferTest.cs", @" ^ 10 1 VimBufferTest.cs", @" . 10 0 VimBufferTest.cs", }; Assert.Equal(string.Join(Environment.NewLine, expectedMarks), _statusUtil.LastStatus); // set an upper and lower mark _vimBuffer.ProcessNotation("jmajmA2k"); _vimBuffer.ProcessNotation("5jp"); interpreter.RunDisplayMarks(s_emptyList); expectedMarks = new[] { @"mark line col file/text", @" ' 9 0 VimBufferTest.cs", @" a 2 0 VimBufferTest.cs", @" z 10 0 VimBufferTest.cs", @" A 3 0 VimBufferTest.cs", @" Z 9 0 VimBufferTest.cs", @" "" 1 0 VimBufferTest.cs", //@" [ 7 0 VimBufferTest.cs", //@" ] 7 1 VimBufferTest.cs", @" ^ 11 1 VimBufferTest.cs", @" . 7 1 VimBufferTest.cs", }; Assert.Equal(string.Join(Environment.NewLine, expectedMarks), _statusUtil.LastStatus); _vimBuffer.ProcessNotation("kV<ESC>"); interpreter.RunDisplayMarks(s_emptyList); expectedMarks = new[] { @"mark line col file/text", @" ' 9 0 VimBufferTest.cs", @" a 2 0 VimBufferTest.cs", @" z 10 0 VimBufferTest.cs", @" A 3 0 VimBufferTest.cs", @" Z 9 0 VimBufferTest.cs", @" "" 1 0 VimBufferTest.cs", //@" [ 7 0 VimBufferTest.cs", //@" ] 7 1 VimBufferTest.cs", @" ^ 11 1 VimBufferTest.cs", @" . 7 1 VimBufferTest.cs", @" < 6 0 VimBufferTest.cs", @" > 6 1 VimBufferTest.cs", }; Assert.Equal(string.Join(Environment.NewLine, expectedMarks), _statusUtil.LastStatus); }