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); }
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); }
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)); }
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); }
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); }
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); }
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); }
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()); }
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); }
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); }
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); }
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)); }
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); }
protected void AssertPartialMapping(string lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null) { AssertPartialMapping(KeyInputSetUtil.OfString(lhs), expectedMapped, expectedRemaining, mode); }
public void BackslasheInRight() { AssertMany(@"/\v", KeyInputSetUtil.OfVimKeyArray(VimKey.Forwardslash, VimKey.Backslash, VimKey.LowerV)); }
protected static void AssertMany(string input, string result) { AssertMany(input, KeyInputSetUtil.OfString(result)); }
public void BackslasheInRight() { AssertMany(@"/\v", KeyInputSetUtil.OfCharArray('/', '\\', 'v')); }
public void EscapeLessThanLiteral() { AssertMany(@"\<home>", KeyInputSetUtil.OfVimKeyArray(VimKey.Backslash, VimKey.Home)); }