Navigation commands

This commit is contained in:
2022-05-24 20:37:12 +02:00
parent cb5260da5d
commit d94d198344
10 changed files with 206 additions and 17 deletions

View File

@@ -13,16 +13,19 @@ public static class MainConfiguration
{
Configuration = new();
PopulateDefaultEditorPrograms(Configuration);
PopulateDefaultKeyBindings(Configuration, _defaultKeybindings.Value, SectionNames.KeybindingSectionName + ":" + nameof(KeyBindingConfiguration.DefaultKeyBindings));
PopulateDefaultKeyBindings(Configuration, _defaultKeybindings.Value,
SectionNames.KeybindingSectionName + ":" + nameof(KeyBindingConfiguration.DefaultKeyBindings));
}
private static void PopulateDefaultKeyBindings(Dictionary<string, string> configuration, List<CommandBindingConfiguration> commandBindingConfigs, string basePath)
private static void PopulateDefaultKeyBindings(Dictionary<string, string> configuration,
List<CommandBindingConfiguration> commandBindingConfigs, string basePath)
{
for (var i = 0; i < commandBindingConfigs.Count; i++)
{
var baseKey = basePath + $":[{i}]:";
var commandBindingConfig = commandBindingConfigs[i];
configuration.Add(baseKey + nameof(CommandBindingConfiguration.Command), commandBindingConfig.Command.ToString());
configuration.Add(baseKey + nameof(CommandBindingConfiguration.Command),
commandBindingConfig.Command.ToString());
for (var j = 0; j < commandBindingConfig.Keys.Count; j++)
{
@@ -52,18 +55,18 @@ public static class MainConfiguration
new CommandBindingConfiguration(CreateElement.CommandName, new[] { Key.C, Key.E }),
//new CommandBindingConfiguration(ConfigCommand.Cut, new[] { Key.D, Key.D }),
//new CommandBindingConfiguration(ConfigCommand.Edit, new KeyConfig(Key.F4)),
new CommandBindingConfiguration(EnterRapidTravelCommand.CommandName, new KeyConfig(Key.OemComma, shift: true)),
new CommandBindingConfiguration(EnterRapidTravelCommand.CommandName,new KeyConfig(Key.OemComma, shift: true)),
//new CommandBindingConfiguration(ConfigCommand.FindByName, new[] { Key.F, Key.N }),
//new CommandBindingConfiguration(ConfigCommand.FindByNameRegex, new[] { Key.F, Key.R }),
//new CommandBindingConfiguration(ConfigCommand.GoToHome, new[] { Key.G, Key.H }),
new CommandBindingConfiguration(GoToHomeCommand.CommandName, new[] { Key.G, Key.H }),
//new CommandBindingConfiguration(ConfigCommand.GoToPath, new KeyConfig(Key.L, ctrl: true)),
//new CommandBindingConfiguration(ConfigCommand.GoToPath, new[] { Key.G, Key.P }),
//new CommandBindingConfiguration(ConfigCommand.GoToProvider, new[] { Key.G, Key.T }),
//new CommandBindingConfiguration(ConfigCommand.GoToRoot, new[] { Key.G, Key.R }),
new CommandBindingConfiguration(GoToProviderCommand.CommandName, new[] { Key.G, Key.T }),
new CommandBindingConfiguration(GoToRootCommand.CommandName, new[] { Key.G, Key.R }),
//new CommandBindingConfiguration(ConfigCommand.HardDelete, new[] { new KeyConfig(Key.D,shift: true), new KeyConfig(Key.D, shift: true) }),
new CommandBindingConfiguration(MarkCommand.CommandName, Key.Space),
//new CommandBindingConfiguration(ConfigCommand.MoveToLast, new KeyConfig(Key.G, shift: true)),
//new CommandBindingConfiguration(ConfigCommand.MoveToFirst, new[] { Key.G, Key.G }),
new CommandBindingConfiguration(MoveCursorToLastCommand.CommandName, new KeyConfig(Key.G, shift: true)),
new CommandBindingConfiguration(MoveCursorToFirstCommand.CommandName, new[] { Key.G, Key.G }),
//new CommandBindingConfiguration(ConfigCommand.NextTimelineBlock, Key.L ),
//new CommandBindingConfiguration(ConfigCommand.NextTimelineCommand, Key.J ),
//new CommandBindingConfiguration(ConfigCommand.OpenInFileBrowser, new[] { Key.O, Key.E }),
@@ -98,8 +101,8 @@ public static class MainConfiguration
//new CommandBindingConfiguration(ConfigCommand.OpenOrRun, Key.Enter),
new CommandBindingConfiguration(MoveCursorUpCommand.CommandName, Key.Up),
new CommandBindingConfiguration(MoveCursorDownCommand.CommandName, Key.Down),
//new CommandBindingConfiguration(ConfigCommand.MoveCursorUpPage, Key.PageUp),
//new CommandBindingConfiguration(ConfigCommand.MoveCursorDownPage, Key.PageDown),
new CommandBindingConfiguration(MoveCursorUpPageCommand.CommandName, Key.PageUp),
new CommandBindingConfiguration(MoveCursorDownPageCommand.CommandName, Key.PageDown),
};
}
@@ -114,11 +117,15 @@ public static class MainConfiguration
for (var i = 0; i < editorPrograms.Count; i++)
{
if (editorPrograms[i].Path is not string path) continue;
configuration.Add($"{SectionNames.ProgramsSectionName}:{nameof(ProgramsConfiguration.DefaultEditorPrograms)}:[{i}]:{nameof(ProgramConfiguration.Path)}", path);
configuration.Add(
$"{SectionNames.ProgramsSectionName}:{nameof(ProgramsConfiguration.DefaultEditorPrograms)}:[{i}]:{nameof(ProgramConfiguration.Path)}",
path);
if (editorPrograms[i].Arguments is string arguments)
{
configuration.Add($"{SectionNames.ProgramsSectionName}:{nameof(ProgramsConfiguration.DefaultEditorPrograms)}:[{i}]:{nameof(ProgramConfiguration.Arguments)}", arguments);
configuration.Add(
$"{SectionNames.ProgramsSectionName}:{nameof(ProgramsConfiguration.DefaultEditorPrograms)}:[{i}]:{nameof(ProgramConfiguration.Arguments)}",
arguments);
}
}
}