@@ -133,3 +133,37 @@ Index: code-server/lib/vscode/src/vs/server/node/server.cli.ts
133133 if (parsedArgs.status) {
134134 await sendToPipe({
135135 type: 'status'
136+ Index: code-server/lib/vscode/src/vs/workbench/services/clipboard/browser/clipboardService.ts
137+ ===================================================================
138+ --- code-server.orig/lib/vscode/src/vs/workbench/services/clipboard/browser/clipboardService.ts
139+ +++ code-server/lib/vscode/src/vs/workbench/services/clipboard/browser/clipboardService.ts
140+ @@ -26,8 +26,17 @@ export class BrowserClipboardService ext
141+ @ILayoutService layoutService: ILayoutService
142+ ) {
143+ super(layoutService, logService);
144+ + window.addEventListener('keydown', event => {
145+ + if (event.key.toLowerCase() === 'p' || (event.key === 'v' && (event.ctrlKey || event.metaKey))) {
146+ + this.lastClipboardTextContent = navigator.clipboard.readText()
147+ + this.lastCLipboardTime = Date.now();
148+ + }
149+ + })
150+ }
151+
152+ + private lastClipboardTextContent?: Promise<string>
153+ + private lastCLipboardTime?: number
154+ +
155+ override async writeText(text: string, type?: string): Promise<void> {
156+ if (!!this.environmentService.extensionTestsLocationURI && typeof type !== 'string') {
157+ type = 'vscode-tests'; // force in-memory clipboard for tests to avoid permission issues
158+ @@ -46,6 +55,11 @@ export class BrowserClipboardService ext
159+ }
160+
161+ try {
162+ + if (this.lastClipboardTextContent && this.lastCLipboardTime && Date.now() - this.lastCLipboardTime < 1000) {
163+ + const content = await this.lastClipboardTextContent;
164+ + if (content) return content
165+ + }
166+ +
167+ return await getActiveWindow().navigator.clipboard.readText();
168+ } catch (error) {
169+ return new Promise<string>(resolve => {
0 commit comments