Beispiel #1
0
 public void KeyRemapMode_OperatorPendingWhenWaitingForMotion()
 {
     Create("hello world");
     _runner.Add(VimUtil.CreateMotionBinding("d"));
     _runner.Run('d');
     Assert.IsTrue(_runner.KeyRemapMode.IsSome(KeyRemapMode.OperatorPending));
 }
Beispiel #2
0
        public void Run_MotionMixedWithNonMotion()
        {
            Create("the dog chased the ball");
            var simple = new[] { "g~g~", "g~~", "gugu", "guu", "gUgU", "gUU" };
            var motion = new[] { "g~", "gu", "gU" };

            foreach (var cur in simple)
            {
                _runner.Add(VimUtil.CreateNormalBinding(cur));
            }

            foreach (var cur in motion)
            {
                _runner.Add(VimUtil.CreateMotionBinding(cur));
            }

            foreach (var cur in simple)
            {
                // Make sure we can run them all
                Assert.IsTrue(_runner.Run(cur).IsComplete);
            }

            foreach (var cur in motion)
            {
                // Make sure we can run them all
                Assert.IsTrue(_runner.Run(cur).IsNeedMoreInput);
                _runner.ResetState();
            }
        }
Beispiel #3
0
 public void KeyRemapMode_LanguageInToArgument()
 {
     Create("hello world");
     _runner.Add(VimUtil.CreateMotionBinding("d"));
     _runner.Run('d');
     _runner.Run('f');
     Assert.AreEqual(KeyRemapMode.Language, _runner.KeyRemapMode.Value);
 }
Beispiel #4
0
 public void KeyRemapMode_OperatorPendingWhenAmbiguousBetweenMotionAndCommand()
 {
     Create("hello world");
     _runner.Add(VimUtil.CreateMotionBinding("d"));
     _runner.Add(VimUtil.CreateNormalBinding("dd"));
     _runner.Run('d');
     Assert.IsTrue(_runner.KeyRemapMode.IsSome(KeyRemapMode.OperatorPending));
 }
Beispiel #5
0
 public void IsWaitingForMoreInput5()
 {
     Create("hello world");
     _runner.Add(VimUtil.CreateMotionBinding("cat"));
     Assert.IsTrue(Run("cata").IsNeedMoreInput);
     Assert.IsTrue(_runner.Run(KeyInputUtil.EscapeKey).IsCancelled);
     Assert.IsFalse(_runner.IsWaitingForMoreInput);
 }
Beispiel #6
0
        public void Run_CommandMatch7()
        {
            Create("foo bar");
            var count1 = 0;

            _runner.Add(VimUtil.CreateMotionBinding("aa", data => { count1++; return(NormalCommand.NewYank(data)); }));
            var count2 = 0;

            _runner.Add(VimUtil.CreateNormalBinding("aab", data => { count2++; return(CommandResult.NewCompleted(ModeSwitch.NoSwitch)); }));
            Run("aaw");
            Assert.AreEqual(1, count1);
            Assert.AreEqual(0, count2);
        }
Beispiel #7
0
        public void Run_CommandMatch6()
        {
            Create(String.Empty);
            var count1 = 0;

            _runner.Add(VimUtil.CreateMotionBinding("aa", data => { count1++; return(NormalCommand.NewYank(data)); }));
            var count2 = 0;

            _runner.Add(VimUtil.CreateLegacyBinding("aab", (count, reg) => { count2++; return(CommandResult.NewCompleted(ModeSwitch.NoSwitch)); }));
            Run("aab");
            Assert.AreEqual(0, count1);
            Assert.AreEqual(1, count2);
        }