Exemple #1
0
        internal static CommandBinding CreateLegacyBinding(string name, Func <FSharpOption <int>, Register, CommandResult> func)
        {
            var fsharpFunc  = func.ToFSharpFunc();
            var list        = name.Select(KeyInputUtil.CharToKeyInput).ToFSharpList();
            var commandName = KeyInputSet.NewManyKeyInputs(list);

            return(CommandBinding.NewLegacyBinding(commandName, CommandFlags.None, fsharpFunc));
        }
Exemple #2
0
            public void GetKeyMappingResultFromMultiple2()
            {
                _map.MapWithNoRemap("aa", "b", KeyRemapMode.Normal);

                var input = "a".Select(KeyInputUtil.CharToKeyInput).ToFSharpList();
                var res   = _map.GetKeyMapping(KeyInputSet.NewManyKeyInputs(input), KeyRemapMode.Normal);

                Assert.True(res.IsNeedsMoreInput);
            }
Exemple #3
0
            public void GetKeyMappingResultFromMultiple1()
            {
                _map.MapWithNoRemap("aa", "b", KeyRemapMode.Normal);

                var input = "aa".Select(KeyInputUtil.CharToKeyInput).ToFSharpList();
                var res   = _map.GetKeyMapping(KeyInputSet.NewManyKeyInputs(input), KeyRemapMode.Normal);

                Assert.Equal('b', res.AsMapped().Item.KeyInputs.Single().Char);
            }
Exemple #4
0
        internal static CommandBinding CreateNormalBinding(string name, Func <CommandData, CommandResult> func)
        {
            var fsharpFunc  = func.ToFSharpFunc();
            var list        = name.Select(KeyInputUtil.CharToKeyInput).ToFSharpList();
            var commandName = KeyInputSet.NewManyKeyInputs(list);
            var command     = NormalCommand.NewPing(new PingData(fsharpFunc));

            return(CommandBinding.NewNormalBinding(commandName, CommandFlags.None, command));
        }
Exemple #5
0
 private KeyInputSet CreateMany(params char[] all)
 {
     return(KeyInputSet.NewManyKeyInputs(all.Select(KeyInputUtil.CharToKeyInput).ToFSharpList()));
 }