Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keybinding to change the (current) tab title #193

Merged
merged 2 commits into from Feb 8, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+27 −9
Diff settings

Always

Just for now

@@ -116,6 +116,19 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
}
};

case Command.ChangeTabTitle:
return new List<KeyBinding>
{
new KeyBinding
{
Command = nameof(Command.ChangeTabTitle),
Ctrl = true,
Alt = false,
Shift = true,
Key = (int)ExtendedVirtualKey.R
}
};

case Command.CloseTab:
return new List<KeyBinding>
{
@@ -45,6 +45,7 @@ public class MainViewModel : ViewModelBase
_keyboardCommandService = keyboardCommandService;
_keyboardCommandService.RegisterCommandHandler(nameof(Command.NewTab), () => AddTerminal(null, false, Guid.Empty));
_keyboardCommandService.RegisterCommandHandler(nameof(Command.ConfigurableNewTab), () => AddTerminal(null, true, Guid.Empty));
_keyboardCommandService.RegisterCommandHandler(nameof(Command.ChangeTabTitle), () => SelectedTerminal.EditTitle());
_keyboardCommandService.RegisterCommandHandler(nameof(Command.CloseTab), CloseCurrentTab);

// Add all of the commands for switching to a tab of a given ID, if there's one open there
@@ -221,6 +221,15 @@ public Task FocusTerminal()
return _terminalView?.FocusTerminal();
}

public async Task EditTitle()
{
var result = await _dialogService.ShowInputDialogAsync("Edit Title");
if (result != null)
{
Title = result;
}
}

public async Task OnViewIsReady(ITerminalView terminalView)
{
_terminalView = terminalView;
@@ -406,15 +415,6 @@ private void SelectTabTheme(string name)
TabTheme = TabThemes.FirstOrDefault(t => t.Name == name);
}

private async Task EditTitle()
{
var result = await _dialogService.ShowInputDialogAsync("Edit Title");
if (result != null)
{
Title = result;
}
}

private async Task TryClose()
{
if (ApplicationSettings.ConfirmClosingTabs)
@@ -19,6 +19,9 @@ public enum Command
[Description("Configurable new tab")]
ConfigurableNewTab,

[Description("Change tab title")]
ChangeTabTitle,

[Description("Close tab")]
CloseTab,

@@ -9,6 +9,7 @@ public class KeyBindings
public ICollection<KeyBinding> PreviousTab { get; set; }
public ICollection<KeyBinding> NewTab { get; set; }
public ICollection<KeyBinding> ConfigurableNewTab { get; set; }
public ICollection<KeyBinding> ChangeTabTitle { get; set; }
public ICollection<KeyBinding> CloseTab { get; set; }
public ICollection<KeyBinding> NewWindow { get; set; }
public ICollection<KeyBinding> ShowSettings { get; set; }
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.