Middle-clicking nonexistent tab pastes text into the code editor (fix #201696) (#211436)

This commit is contained in:
Benjamin Pasero 2024-04-26 12:22:41 +02:00 committed by GitHub
parent e229ffdb0e
commit edb368fc43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/multieditortabscontrol';
import { isMacintosh, isWindows } from 'vs/base/common/platform';
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import { shorten } from 'vs/base/common/labels';
import { EditorResourceAccessor, Verbosity, IEditorPartOptions, SideBySideEditor, DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, IUntypedEditorInput, preventEditorClose, EditorCloseMethod, EditorsOrder, IToolbarActions } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
@ -316,6 +316,15 @@ export class MultiEditorTabsControl extends EditorTabsControl {
}
}));
// Prevent auto-pasting (https://github.com/microsoft/vscode/issues/201696)
if (isLinux) {
this._register(addDisposableListener(tabsContainer, EventType.MOUSE_UP, e => {
if (e.button === 1) {
e.preventDefault();
}
}));
}
// Drag & Drop support
let lastDragEvent: DragEvent | undefined = undefined;
let isNewWindowOperation = false;