Minimize patched lines
This commit is contained in:
@ -5,8 +5,13 @@ import { IWorkbenchActionRegistry, Extensions } from "vs/workbench/common/action
|
||||
import { SyncActionDescriptor } from "vs/platform/actions/common/actions";
|
||||
import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey";
|
||||
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions";
|
||||
import { TerminalPasteAction } from "vs/workbench/parts/terminal/electron-browser/terminalActions";
|
||||
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/parts/terminal/common/terminal";
|
||||
import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
|
||||
import { client } from "../client";
|
||||
|
||||
// Intercept adding workbench actions so we can skip actions that won't work.
|
||||
// Intercept adding workbench actions so we can skip actions that won't work or
|
||||
// modify actions that need different conditions, keybindings, etc.
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
|
||||
const originalRegister = registry.registerWorkbenchAction.bind(registry);
|
||||
registry.registerWorkbenchAction = (descriptor: SyncActionDescriptor, alias: string, category?: string, when?: ContextKeyExpr): IDisposable => {
|
||||
@ -17,6 +22,17 @@ registry.registerWorkbenchAction = (descriptor: SyncActionDescriptor, alias: str
|
||||
return {
|
||||
dispose: (): void => undefined,
|
||||
};
|
||||
|
||||
case TerminalPasteAction.ID: // Modify the Windows keybinding and add our context key.
|
||||
// tslint:disable-next-line no-any override private
|
||||
(descriptor as any)._keybindings = {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_V,
|
||||
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_V },
|
||||
win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V },
|
||||
mac: { primary: 0 },
|
||||
};
|
||||
// tslint:disable-next-line no-any override private
|
||||
(descriptor as any)._keybindingContext = ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FOCUS, client.clipboardContextKey);
|
||||
}
|
||||
|
||||
return originalRegister(descriptor, alias, category, when);
|
||||
|
Reference in New Issue
Block a user