public void KeyRemapMode_LongCommandPropagateMode() { Create("hello world"); _runner.Add(VimUtil.CreateComplexNormalBinding("a", x => true, KeyRemapMode.Language)); _runner.Run('a'); Assert.IsTrue(_runner.KeyRemapMode.IsSome(KeyRemapMode.Language)); _runner.Run('b'); Assert.IsTrue(_runner.KeyRemapMode.IsSome(KeyRemapMode.Language)); }
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.IsTrue(_runner.Run("food").IsComplete); Assert.AreEqual("ood", seen); }
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.IsTrue(res.IsError); })); var res2 = _runner.Run("ab"); Assert.IsTrue(res2.IsComplete); }
public void Run_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.IsTrue(didEscape); Assert.IsTrue(didRun); }