private static MotionResult CreateMotionResult() { var point = MockObjectFactory.CreateSnapshotPoint(42); return(VimUtil.CreateMotionResult( new SnapshotSpan(point, point), true, MotionKind.CharacterWiseInclusive)); }
public void MoveCaretToMotionResult_CaretAfterLastLine() { Create("dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( _textBuffer.GetLineRange(0).ExtentIncludingLineBreak, true, MotionKind.NewLineWise(CaretColumn.AfterLastLine)); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(_textBuffer.GetLine(1).Start, _textView.GetCaretPoint()); }
public void MoveCaretToMotionResult_InVirtualSpaceWithNoVirtualEdit() { Create("foo", "bar", "baz"); var data = VimUtil.CreateMotionResult( new SnapshotSpan(_textBuffer.CurrentSnapshot, 1, 2), true, MotionKind.CharacterWiseExclusive); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(2, _textView.GetCaretPoint().Position); }
public void MoveCaretToMotionResult14() { Create("dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( _textBuffer.GetLineRange(0, 1).ExtentIncludingLineBreak, false, MotionKind.CharacterWiseExclusive); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(_textBuffer.GetLine(0).Start, _textView.GetCaretPoint()); }
public void MoveCaretToMotionResult_ReverseLineWiseWithColumn() { Create(" dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( span: _textView.GetLineRange(0, 1).ExtentIncludingLineBreak, isForward: false, motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(1))); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(1, _textView.GetCaretPoint().Position); }
public void MoveCaretToMotionResult11() { Create("dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( _textBuffer.GetLineRange(0, 1).Extent, false, MotionKind.CharacterWiseInclusive); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(Tuple.Create(0, 0), SnapshotPointUtil.GetLineColumn(_textView.GetCaretPoint())); }
public void MoveCaretToMotionResult12() { Create("dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( _textBuffer.GetLineRange(0, 1).ExtentIncludingLineBreak, false, MotionKind.NewLineWise(CaretColumn.NewInLastLine(2))); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(Tuple.Create(0, 2), SnapshotPointUtil.GetLineColumn(_textView.GetCaretPoint())); }
public void MoveCaretToMotionResult10() { Create("foo", "bar", ""); var data = VimUtil.CreateMotionResult( _textBuffer.GetLineRange(0, 1).Extent, true, MotionKind.NewLineWise(CaretColumn.NewInLastLine(0))); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(Tuple.Create(1, 0), SnapshotPointUtil.GetLineColumn(_textView.GetCaretPoint())); }
public void MoveCaretToMotionResult7() { Create("foo", "bar", ""); var data = VimUtil.CreateMotionResult( new SnapshotSpan(_textBuffer.CurrentSnapshot, 0, _textBuffer.CurrentSnapshot.Length), true, MotionKind.NewLineWise(CaretColumn.None)); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(2, _textView.GetCaretPoint().GetContainingLine().LineNumber); }
public void MoveCaretToMotionResult4() { Create("foo", "bar", "baz"); var data = VimUtil.CreateMotionResult( new SnapshotSpan(_textBuffer.CurrentSnapshot, 0, 3), false, MotionKind.CharacterWiseInclusive); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(0, _textView.GetCaretPoint().Position); }
public void MaintainCaretColumn_Down() { Create("the dog chased the ball", "hello", "the cat climbed the tree"); var motionResult = VimUtil.CreateMotionResult( _textView.GetLineRange(0, 1).ExtentIncludingLineBreak, motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(2)), flags: MotionResultFlags.MaintainCaretColumn); _operations.MoveCaretToMotionResult(motionResult); Assert.AreEqual(2, _operationsRaw.MaintainCaretColumn.Value); }
public void MaintainCaretColumn_IgnoreIfFlagNotSpecified() { Create("the dog chased the ball", "hello", "the cat climbed the tree"); var motionResult = VimUtil.CreateMotionResult( _textView.GetLineRange(0, 1).ExtentIncludingLineBreak, motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(2)), flags: MotionResultFlags.None); var data = VimUtil.CreateMotionResult( new SnapshotSpan(_textBuffer.CurrentSnapshot, 1, 2), true, MotionKind.CharacterWiseInclusive); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(2, _textView.GetCaretPoint().Position); }