Example #1
0
            public void HandleLessThanEscapeLiteral()
            {
                Assert.True(_map.AddKeyMapping("a", "<lt>lt>", allowRemap: false, KeyRemapMode.Normal));
                var result = _map.Map("a", KeyRemapMode.Normal);

                Assert.Equal(KeyInputSetUtil.OfString("<lt>"), result.AsMapped().KeyInputSet);
            }
Example #2
0
            public void GetKeyMappingResult_RemainderIsMappable()
            {
                var result = _map.GetKeyMappingResult("dog", KeyRemapMode.Normal).AsPartiallyMapped();

                Assert.Equal(KeyInputSetUtil.OfString("d"), result.Item1);
                Assert.Equal(KeyInputSetUtil.OfString("og"), result.Item2);
            }
Example #3
0
            private void AssertMacroRegister(char name, string value)
            {
                var register    = _vim.RegisterMap.GetRegister(name);
                var keyInputSet = KeyInputSetUtil.OfList(register.RegisterValue.KeyInputs);

                Assert.Equal(value, KeyNotationUtil.KeyInputSetToString(keyInputSet));
            }
Example #4
0
            public void EscapeLessThanSymbol()
            {
                Assert.True(_map.MapWithNoRemap("a", @"\<Home>", KeyRemapMode.Normal));
                var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal);

                Assert.Equal(KeyInputSetUtil.OfVimKeyArray(VimKey.Backslash, VimKey.Home), result.AsMapped().Item);
            }
Example #5
0
        public void MapWithNoRemap_EscapeLessThanSymbol()
        {
            Assert.IsTrue(_map.MapWithNoRemap("a", @"\<Home>", KeyRemapMode.Normal));
            var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal);

            Assert.AreEqual(KeyInputSetUtil.OfString("<Home>"), result.AsMapped().Item);
        }
Example #6
0
            public void HandleLessThanEscapeLiteral()
            {
                Assert.True(_map.MapWithNoRemap("a", "<lt>lt>", KeyRemapMode.Normal));
                var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal);

                Assert.Equal(KeyInputSetUtil.OfString("<lt>"), result.AsMapped().Item);
            }
Example #7
0
            public void GetKeyMapping1()
            {
                Assert.True(_map.MapWithRemap("a", "b", KeyRemapMode.Normal));
                Assert.True(_map.MapWithRemap("b", "a", KeyRemapMode.Normal));
                var ret = _map.GetKeyMapping(KeyInputSetUtil.OfChar('a'), KeyRemapMode.Normal);

                Assert.True(ret.IsRecursive);
            }
Example #8
0
        protected void AssertMapping(KeyInputSet lhs, string expected, KeyRemapMode mode = null)
        {
            mode = mode ?? KeyRemapMode.Normal;
            var ret = _map.GetKeyMappingResult(lhs, mode);

            Assert.True(ret.IsMapped);
            Assert.Equal(KeyInputSetUtil.OfString(expected), ret.GetMappedKeyInputs());
        }
Example #9
0
            public void Ambiguous_ResolveLonger()
            {
                Assert.True(_map.MapWithNoRemap("aa", "foo", KeyRemapMode.Normal));
                Assert.True(_map.MapWithNoRemap("aaa", "bar", KeyRemapMode.Normal));
                var ret = _map.GetKeyMappingResult("aaa", KeyRemapMode.Normal);

                Assert.True(ret.IsMapped);
                Assert.Equal(KeyInputSetUtil.OfString("bar"), ret.AsMapped().Item);
            }
Example #10
0
            public void Ambiguous_ResolveLonger()
            {
                Assert.True(_map.AddKeyMapping("aa", "foo", allowRemap: false, KeyRemapMode.Normal));
                Assert.True(_map.AddKeyMapping("aaa", "bar", allowRemap: false, KeyRemapMode.Normal));
                var ret = _map.Map("aaa", KeyRemapMode.Normal);

                Assert.True(ret.IsMapped);
                Assert.Equal(KeyInputSetUtil.OfString("bar"), ret.AsMapped().KeyInputSet);
            }
Example #11
0
        public void GetKeyMapping1()
        {
            Assert.IsTrue(_map.MapWithRemap("a", "b", KeyRemapMode.Normal));
            Assert.IsTrue(_map.MapWithRemap("b", "a", KeyRemapMode.Normal));
            var ret = _map.GetKeyMapping(KeyInputSetUtil.OfChar('a'), KeyRemapMode.Normal);

            Assert.IsTrue(ret.IsRecursiveMapping);
            Assert.AreEqual('b', ret.AsRecursiveMapping().Item.KeyInputs.Single().Char);
        }
Example #12
0
        public static KeyInputSet GetMappedKeyInputs(this KeyMappingResult res)
        {
            if (res.IsMapped)
            {
                return(res.AsMapped().Item);
            }

            var partialMap = res.AsPartiallyMapped();

            return(KeyInputSetUtil.Combine(partialMap.item1, partialMap.item2));
        }
Example #13
0
        protected void AssertPartialMapping(KeyInputSet lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null)
        {
            mode = mode ?? KeyRemapMode.Normal;
            var ret = _map.GetKeyMappingResult(lhs, mode);

            Assert.True(ret.IsPartiallyMapped);

            var partiallyMapped = ret.AsPartiallyMapped();

            Assert.Equal(KeyInputSetUtil.OfString(expectedMapped), partiallyMapped.Item1);
            Assert.Equal(KeyInputSetUtil.OfString(expectedRemaining), partiallyMapped.Item2);
        }
Example #14
0
 protected void AssertPartialMapping(string lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null)
 {
     AssertPartialMapping(KeyInputSetUtil.OfString(lhs), expectedMapped, expectedRemaining, mode);
 }
Example #15
0
 public void BackslasheInRight()
 {
     AssertMany(@"/\v", KeyInputSetUtil.OfVimKeyArray(VimKey.Forwardslash, VimKey.Backslash, VimKey.LowerV));
 }
Example #16
0
 protected static void AssertMany(string input, string result)
 {
     AssertMany(input, KeyInputSetUtil.OfString(result));
 }
Example #17
0
 public void BackslasheInRight()
 {
     AssertMany(@"/\v", KeyInputSetUtil.OfCharArray('/', '\\', 'v'));
 }
Example #18
0
 public void EscapeLessThanLiteral()
 {
     AssertMany(@"\<home>", KeyInputSetUtil.OfVimKeyArray(VimKey.Backslash, VimKey.Home));
 }