mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-17 15:24:40 +01:00
Force ctrl+v to not be sent to shell in Firefox
Paste wasn't working in Firefox or other browsers not supporting navigator.clipboard.readText because xterm.js would process the keystroke, send it over to the shell and prevent the default (paste) from occurring. This change Forces ctrl+v to be ignored by xterm.js' keyboard event processing for such browsers, the keybinding won't be customizable but this seems to be the only way.
This commit is contained in:
@@ -45,6 +45,7 @@ import { EnvironmentVariableInfoWidget } from 'vs/workbench/contrib/terminal/bro
|
||||
import { IEnvironmentVariableInfo } from 'vs/workbench/contrib/terminal/common/environmentVariable';
|
||||
import { TerminalLaunchHelpAction } from 'vs/workbench/contrib/terminal/browser/terminalActions';
|
||||
import { TypeAheadAddon } from 'vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon';
|
||||
import { BrowserFeatures } from 'vs/base/browser/canIUse';
|
||||
|
||||
// How long in milliseconds should an average frame take to render for a notification to appear
|
||||
// which suggests the fallback DOM-based renderer
|
||||
@@ -564,6 +565,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fallback to force ctrl+v to paste on browsers that do not support
|
||||
// navigator.clipboard.readText
|
||||
if (!BrowserFeatures.clipboard.readText && event.key === 'v' && event.ctrlKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
this._register(dom.addDisposableListener(xterm.element, 'mousedown', () => {
|
||||
|
||||
Reference in New Issue
Block a user