public void OperatorPendingWhenWaitingForMotion() { Create("hello world"); _runner.Add(VimUtil.CreateMotionBinding("d")); _runner.Run('d'); Assert.Equal(_runner.KeyRemapMode, KeyRemapMode.OperatorPending); }
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.True(_runner.Run(cur).IsComplete); } foreach (var cur in motion) { // Make sure we can run them all Assert.True(_runner.Run(cur).IsNeedMoreInput); _runner.ResetState(); } }
public void OperatorPendingWhenWaitingForMotionLegacy() { Create("hello world"); _runner.Add(VimUtil.CreateMotionBinding("d")); _runner.Run('d'); Assert.True(_runner.KeyRemapMode.IsSome(KeyRemapMode.OperatorPending)); }
public void OperatorPendingWhenAmbiguousBetweenMotionAndCommand() { Create("hello world"); _runner.Add(VimUtil.CreateMotionBinding("d")); _runner.Add(VimUtil.CreateNormalBinding("dd")); _runner.Run('d'); Assert.Equal(_runner.KeyRemapMode, KeyRemapMode.OperatorPending); }
public void IsWaitingForMoreInput5() { Create("hello world"); _runner.Add(VimUtil.CreateMotionBinding("cat")); Assert.True(Run("cata").IsNeedMoreInput); Assert.True(_runner.Run(KeyInputUtil.EscapeKey).IsCancelled); Assert.False(_runner.IsWaitingForMoreInput); }
public void LanguageInToArgument() { Create("hello world"); _runner.Add(VimUtil.CreateMotionBinding("d")); _runner.Run('d'); _runner.Run('f'); Assert.Equal(KeyRemapMode.Language, _runner.KeyRemapMode); }
public void 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.Equal(1, count1); Assert.Equal(0, count2); }