@@ -137,21 +137,30 @@ Index: code-server/lib/vscode/src/vs/workbench/services/clipboard/browser/clipbo
137137===================================================================
138138--- code-server.orig/lib/vscode/src/vs/workbench/services/clipboard/browser/clipboardService.ts
139139+++ code-server/lib/vscode/src/vs/workbench/services/clipboard/browser/clipboardService.ts
140- @@ -15,6 +15,7 @@ import { IWorkbenchEnvironmentService }
140+ @@ -15,19 +15,36 @@ import { IWorkbenchEnvironmentService }
141141 import { ILogService } from '../../../../platform/log/common/log.js';
142142 import { ILayoutService } from '../../../../platform/layout/browser/layoutService.js';
143143 import { getActiveWindow } from '../../../../base/browser/dom.js';
144144+ import { isSafari } from '../../../../base/browser/browser.js';
145+ + import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
145146
146147 export class BrowserClipboardService extends BaseBrowserClipboardService {
147148
148- @@ -26,8 +27,19 @@ export class BrowserClipboardService ext
149+ constructor(
150+ @INotificationService private readonly notificationService: INotificationService,
151+ + @IContextKeyService private readonly contextKeyService: IContextKeyService,
152+ @IOpenerService private readonly openerService: IOpenerService,
153+ @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
154+ @ILogService logService: ILogService,
149155 @ILayoutService layoutService: ILayoutService
150156 ) {
151157 super(layoutService, logService);
152158+ if (isSafari) {
153159+ window.addEventListener('keydown', event => {
154- + if (event.key.toLowerCase() === 'p' || (event.key === 'v' && (event.ctrlKey || event.metaKey))) {
160+ + if (
161+ + (event.key.toLowerCase() === 'p' && this.contextKeyService.getContextKeyValue('vim.mode') === 'Normal') ||
162+ + (event.key === 'v' && (event.ctrlKey || event.metaKey) && this.contextKeyService.getContextKeyValue('vim.mode') === 'SearchInProgressMode')
163+ + ) {
155164+ this.lastClipboardTextContent = navigator.clipboard.readText()
156165+ this.lastCLipboardTime = Date.now();
157166+ }
@@ -165,7 +174,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/clipboard/browser/clipbo
165174 override async writeText(text: string, type?: string): Promise<void> {
166175 if (!!this.environmentService.extensionTestsLocationURI && typeof type !== 'string') {
167176 type = 'vscode-tests'; // force in-memory clipboard for tests to avoid permission issues
168- @@ -46,6 +58 ,15 @@ export class BrowserClipboardService ext
177+ @@ -46,6 +63 ,15 @@ export class BrowserClipboardService ext
169178 }
170179
171180 try {
0 commit comments