Beispiel #1
0
 public void DiscriminatedUnions()
 {
     Run(BlockCaretLocation.BottomLeft, BlockCaretLocation.BottomRight);
     Run(CaretColumn.NewInLastLine(0), CaretColumn.NewInLastLine(1));
     Run(CaretColumn.NewInLastLine(0), CaretColumn.NewInLastLine(2));
     Run(CaseSpecifier.IgnoreCase, CaseSpecifier.None);
     Run(ChangeCharacterKind.Rot13, ChangeCharacterKind.ToggleCase);
     Run(CharSearchKind.TillChar, CharSearchKind.ToChar);
     Run(KeyRemapMode.Language, KeyRemapMode.Normal);
     Run(DirectiveKind.If, DirectiveKind.Else);
     Run(MagicKind.NoMagic, MagicKind.Magic);
     Run(MatchingTokenKind.Braces, MatchingTokenKind.Brackets);
     Run(MotionContext.AfterOperator, MotionContext.Movement);
     Run(MotionKind.LineWise, MotionKind.CharacterWiseExclusive);
     Run(NumberFormat.Alpha, NumberFormat.Decimal);
     Run(NumberValue.NewAlpha('c'), NumberValue.NewDecimal(1));
     Run(OperationKind.CharacterWise, OperationKind.LineWise);
     Run(QuickFix.Next, QuickFix.Previous);
     Run(RegisterOperation.Delete, RegisterOperation.Yank);
     Run(SectionKind.Default, SectionKind.OnCloseBrace);
     Run(SentenceKind.Default, SentenceKind.NoTrailingCharacters);
     Run(SettingKind.Number, SettingKind.String);
     Run(SelectionKind.Exclusive, SelectionKind.Inclusive);
     Run(SettingValue.NewNumber(1), SettingValue.NewNumber(2));
     Run(TextObjectKind.AlwaysCharacter, TextObjectKind.AlwaysLine);
     Run(UnmatchedTokenKind.CurlyBracket, UnmatchedTokenKind.Paren);
     Run(WordKind.BigWord, WordKind.NormalWord);
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 internal static MotionResult CreateMotionResult(
     SnapshotSpan span,
     bool isForward            = true,
     MotionKind motionKind     = null,
     MotionResultFlags flags   = MotionResultFlags.None,
     CaretColumn desiredColumn = null)
 {
     motionKind    = motionKind ?? MotionKind.CharacterWiseInclusive;
     desiredColumn = desiredColumn ?? CaretColumn.None;
     return(new MotionResult(span, span, isForward, motionKind, flags, desiredColumn));
 }
Beispiel #4
0
        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()));
        }
Beispiel #5
0
        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()));
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        internal static MotionResult CreateMotionResult(
            SnapshotSpan span,
            bool isForward              = true,
            MotionKind motionKind       = null,
            OperationKind operationKind = null,
            int?column = null)
        {
            motionKind    = motionKind ?? MotionKind.Inclusive;
            operationKind = operationKind ?? OperationKind.CharacterWise;
            var col = column.HasValue ? FSharpOption.Create(CaretColumn.NewInLastLine(column.Value)) : FSharpOption <CaretColumn> .None;

            return(new MotionResult(span, isForward, motionKind, operationKind, col));
        }
Beispiel #8
0
 public void AssertData(MotionResult data, SnapshotSpan? span, MotionKind motionKind = null, CaretColumn desiredColumn = null)
 {
     if (span.HasValue)
     {
         Assert.Equal(span.Value, data.Span);
     }
     if (motionKind != null)
     {
         Assert.Equal(motionKind, data.MotionKind);
     }
     if (desiredColumn != null)
     {
         Assert.Equal(desiredColumn, data.DesiredColumn);
     }
 }
Beispiel #9
0
        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);
        }
Beispiel #10
0
 public static CaretColumn.InLastLine AsInLastLine(this CaretColumn column)
 {
     return((CaretColumn.InLastLine)column);
 }