コード例 #1
0
ファイル: MotionCaptureTest.cs プロジェクト: sh54/VsVim
        private static MotionResult CreateMotionResult()
        {
            var point = MockObjectFactory.CreateSnapshotPoint(42);

            return(VimUtil.CreateMotionResult(
                       new SnapshotSpan(point, point),
                       true,
                       MotionKind.CharacterWiseInclusive));
        }
コード例 #2
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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());
        }
コード例 #3
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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);
        }
コード例 #4
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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());
        }
コード例 #5
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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);
        }
コード例 #6
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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()));
        }
コード例 #7
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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()));
        }
コード例 #8
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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()));
        }
コード例 #9
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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);
        }
コード例 #10
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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);
        }
コード例 #11
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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);
        }
コード例 #12
0
ファイル: CommonOperationsTest.cs プロジェクト: sh54/VsVim
        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);
        }