コード例 #1
0
 public void LongCommandPropagateMode()
 {
     Create("hello world");
     _runner.Add(VimUtil.CreateComplexNormalBinding("a", x => true, KeyRemapMode.Language));
     _runner.Run('a');
     Assert.Equal(_runner.KeyRemapMode, KeyRemapMode.Language);
     _runner.Run('b');
     Assert.Equal(_runner.KeyRemapMode, KeyRemapMode.Language);
 }
コード例 #2
0
ファイル: CommandRunnerTest.cs プロジェクト: zhoutao929/VsVim
            public void ComplexCommand_EnsureItLoops()
            {
                Create("hello world");
                var seen = string.Empty;
                Func <KeyInput, bool> func = ki =>
                {
                    seen += ki.Char.ToString();
                    return(seen != "ood");
                };

                _runner.Add(VimUtil.CreateComplexNormalBinding("f", func));
                Assert.True(_runner.Run("food").IsComplete);
                Assert.Equal("ood", seen);
            }
コード例 #3
0
            public void NestedRun_DontAllowRunDuringBind()
            {
                Create("hello world");
                _runner.Add(VimUtil.CreateNormalBinding("b"));
                _runner.Add(VimUtil.CreateComplexNormalBinding(
                                "a",
                                _ =>
                {
                    var res = _runner.Run(KeyInputUtil.CharToKeyInput('b'));
                    Assert.True(res.IsError);
                }));

                var res2 = _runner.Run("ab");

                Assert.True(res2.IsComplete);
            }
コード例 #4
0
            public void RespectHandleEscapeFlag()
            {
                Create("hello world");
                var didRun    = false;
                var didEscape = false;

                _runner.Add(VimUtil.CreateComplexNormalBinding(
                                "c",
                                ki =>
                {
                    didRun    = true;
                    didEscape = ki == KeyInputUtil.EscapeKey;
                },
                                CommandFlags.HandlesEscape));
                _runner.Run('c');
                _runner.Run(VimKey.Escape);
                Assert.True(didEscape);
                Assert.True(didRun);
            }