Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion EditorTextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ public void Format()
{
Text = editorContext.Format(Text.ToString());
}
public void Undo()
{
InvokeKeybindings(new KeyEvent(Key.CtrlMask | Key.Z, new KeyModifiers { Ctrl = true }));
}
public void Redo()
{
InvokeKeybindings(new KeyEvent(Key.CtrlMask | Key.R, new KeyModifiers { Ctrl = true }));
}
public string Run(string path, bool exit = false)
{
var output = String.Empty;
Expand Down Expand Up @@ -305,4 +313,4 @@ void GetEncodedRegionBounds(out long start, out long end)
return (w, h);
}
}
}
}
30 changes: 27 additions & 3 deletions ShowEditorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,18 @@ private void SetMenuBar(Toplevel top)
new MenuItem ("_Quit", "", Quit, shortcut: Key.CtrlMask | Key.Q)
}));
menuItems.Add(new MenuBarItem("_Edit", new MenuItem[] {
new MenuItem ("_Find", "", () => Find(), shortcut: Key.CtrlMask | Key.F),
new MenuItem ("_Replace", "", () => Replace(), shortcut: Key.CtrlMask | Key.H),
new MenuItem ("_Undo", "", () => textEditor.Undo(), shortcut: Key.CtrlMask | Key.Z),
new MenuItem ("_Redo", "", () => textEditor.Redo(), shortcut: Key.CtrlMask | Key.R),
null,
new MenuItem ("Cu_t", "", () => textEditor.Cut(), shortcut: Key.CtrlMask | Key.X),
new MenuItem ("_Copy", "", () => textEditor.Copy(), shortcut: Key.CtrlMask | Key.C),
new MenuItem ("_Paste", "", () => textEditor.Paste(), shortcut: Key.CtrlMask | Key.Y),
null,
new MenuItem ("_Select All", "", () => SelectAll(), shortcut: Key.CtrlMask | Key.T),
new MenuItem ("_Delete All", "", () => textEditor.DeleteAll(), shortcut: Key.CtrlMask | Key.G),
null,
new MenuItem ("_Find", "", () => Find(), shortcut: Key.CtrlMask | Key.F),
new MenuItem ("_Replace", "", () => Replace(), shortcut: Key.CtrlMask | Key.H),
//new MenuItem("Autocomplete", "", Autocomplete, shortcut: Key.CtrlMask | Key.Space),
}));

Expand Down Expand Up @@ -171,6 +179,8 @@ private void SetMenuBar(Toplevel top)
}

menuItems.Add(new MenuBarItem("_Help", new[] {
new MenuItem("_Keyboard Shortcuts", "", ShowKeyboardShortcuts),
null,
new MenuItem("_About", "", () => MessageBox.Query("About", $"PowerShell Pro Tools Terminal Editor\nVersion: {base.MyInvocation.MyCommand.Module.Version.ToString()}\n", "Ok")),
new MenuItem("_GitHub", "", () => {
try {
Expand All @@ -193,6 +203,20 @@ private void SetMenuBar(Toplevel top)

}

private void ShowKeyboardShortcuts()
{
MessageBox.Query("Keyboard Shortcuts",
"File: Open Ctrl+O, Save Ctrl+S, Quit Ctrl+Q\n" +
"Edit: Undo Ctrl+Z, Redo Ctrl+R\n" +
" Cut Ctrl+X, Copy Ctrl+C, Paste Ctrl+Y\n" +
" Select All Ctrl+T, Delete All Ctrl+G\n" +
" Find Ctrl+F, Replace Ctrl+H\n" +
"Format: Format Ctrl+Shift+R\n" +
"Run: Run F5, Execute Selection F8\n" +
" Exit and Run Ctrl+Shift+F5",
"Ok");
}

protected override void ProcessRecord()
{
textEditor = new EditorTextView(_runspace);
Expand Down Expand Up @@ -960,4 +984,4 @@ private void UpdatePosition()

}
}
}
}
Loading