monaco-editor-core 0.58.0 → 0.59.0-dev-20261124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +2 -0
- package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +3 -0
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxNative.js +4 -2
- package/esm/vs/base/browser/ui/selectBox/selectBoxNative.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +27 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/common/cancellation.js +3 -1
- package/esm/vs/base/common/cancellation.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +8 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseTarget.js +15 -6
- package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
- package/esm/vs/editor/browser/view.js +3 -2
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +12 -8
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js +7 -11
- package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +246 -238
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +71 -71
- package/esm/vs/editor/common/editorContextKeys.js +53 -53
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js +3 -1
- package/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +1 -0
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -11
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +17 -17
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +13 -13
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js.map +1 -1
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +17 -17
- package/esm/vs/editor/contrib/find/browser/findWidget.js +29 -29
- package/esm/vs/editor/contrib/folding/browser/folding.css +15 -0
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidget.js +0 -5
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidget.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidgetWrapper.js +0 -3
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidgetWrapper.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/hover.css +6 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverTypes.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +19 -39
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +7 -7
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/indentation/common/indentation.js +14 -3
- package/esm/vs/editor/contrib/indentation/common/indentation.js.map +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +21 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +3 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +31 -31
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +11 -10
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +12 -12
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -9
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js +93 -38
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +18 -18
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +3 -3
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +3 -3
- package/esm/vs/editor/editor.api.d.ts +5 -0
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +68 -68
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +30 -31
- package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +12 -12
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +3 -3
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationModels.js +15 -3
- package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js +12 -12
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +10 -10
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +5 -5
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickTree.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +19 -19
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/confettiColors.js +6 -6
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +48 -48
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +10 -10
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +5 -0
- package/package.json +3 -3
|
@@ -76,7 +76,9 @@ export var CancellationToken;
|
|
|
76
76
|
return CancellationToken.Cancelled;
|
|
77
77
|
}
|
|
78
78
|
const token = lifetime.add(new MutableToken());
|
|
79
|
-
|
|
79
|
+
const onAbort = () => token.cancel();
|
|
80
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
81
|
+
lifetime.add(toDisposable(() => signal.removeEventListener('abort', onAbort)));
|
|
80
82
|
return token;
|
|
81
83
|
}
|
|
82
84
|
CancellationToken.fromAbortSignal = fromAbortSignal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/cancellation.ts","vs/base/common/cancellation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAe,YAAY,EAAE,MAAM,gB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AAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC;QAE3C,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,YAAY,YAAY,EAAE,CAAC;YAChD,kBAAkB;YAClB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;IACF,CAAC;IAED,OAAO,CAAC,SAAkB,KAAK;QAC9B,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,MAAM,EAAE,CAAC;QACf,CAAC;QACD,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,0DAA0D;YAC1D,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC;QAEtC,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,YAAY,YAAY,EAAE,CAAC;YAChD,mBAAmB;YACnB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;CACD;AAED,MAAM,UAAU,eAAe,CAAC,KAAsB;IACrD,MAAM,MAAM,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAC7C,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC","file":"cancellation.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tlifetime.add(Event.once(Event.fromDOMEventEmitter(signal, 'abort'))(() => token.cancel()));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tlifetime.add(Event.once(Event.fromDOMEventEmitter(signal, 'abort'))(() => token.cancel()));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/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C,KAAK,CAAC;AACrB,CAAC","file":"cancellation.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tconst onAbort = () => token.cancel();\n\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\t\tlifetime.add(toDisposable(() => signal.removeEventListener('abort', onAbort)));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n\n\texport function throwIfCanceled(token: CancellationToken): void {\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\t}\n\n\t/**\n\t * Cancels when any input is cancelled; the lifetime owns the forwarding subscriptions.\n\t * A single distinct active input is returned directly and still reflects cancellation after lifetime disposal.\n\t */\n\texport function any(tokens: readonly CancellationToken[], lifetime: DisposableStore): CancellationToken {\n\t\tif (tokens.some(token => token.isCancellationRequested)) {\n\t\t\treturn Cancelled;\n\t\t}\n\t\tconst active = [...new Set(tokens.filter(token => token !== None))];\n\t\tif (active.length < 2) {\n\t\t\treturn active[0] ?? None;\n\t\t}\n\t\tconst source = new CancellationTokenSource();\n\t\tlifetime.add(toDisposable(() => {\n\t\t\t// Cancellation owns emitter disposal until every listener has been notified.\n\t\t\tif (!source.token.isCancellationRequested) {\n\t\t\t\tsource.dispose();\n\t\t\t}\n\t\t}));\n\t\tconst listeners = lifetime.add(new DisposableStore());\n\t\tfor (const token of active) {\n\t\t\tlisteners.add(token.onCancellationRequested(() => {\n\t\t\t\tlisteners.dispose();\n\t\t\t\tsource.cancel();\n\t\t\t}));\n\t\t}\n\t\treturn source.token;\n\t}\n\n\t/**\n\t * Creates a CancellationToken that is tied to the lifetime of the provided AbortSignal.\n\t */\n\texport function fromAbortSignal(signal: AbortSignal, lifetime: DisposableStore): CancellationToken {\n\t\tif (signal.aborted) {\n\t\t\treturn CancellationToken.Cancelled;\n\t\t}\n\t\tconst token = lifetime.add(new MutableToken());\n\t\tconst onAbort = () => token.cancel();\n\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\t\tlifetime.add(toDisposable(() => signal.removeEventListener('abort', onAbort)));\n\t\treturn token;\n\t}\n\n\t/** Creates an AbortSignal that aborts with CancellationError when the token is cancelled. */\n\texport const toAbortSignal = (token: CancellationToken, lifetime: DisposableStore): AbortSignal => {\n\t\tif (token === CancellationToken.None) {\n\t\t\treturn new AbortController().signal;\n\t\t}\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn AbortSignal.abort(new CancellationError());\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tlifetime.add(token.onCancellationRequested(() => controller.abort(new CancellationError())));\n\t\treturn controller.signal;\n\t};\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<void> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<void> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<void>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n"]}
|
|
@@ -15,6 +15,7 @@ import { ViewEventHandler } from '../../common/viewEventHandler.js';
|
|
|
15
15
|
import { MouseWheelClassifier } from '../../../base/browser/ui/scrollbar/scrollableElement.js';
|
|
16
16
|
import { TopBottomDragScrolling, LeftRightDragScrolling } from './dragScrolling.js';
|
|
17
17
|
import { TextDirection } from '../../common/model.js';
|
|
18
|
+
import { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from '../../../base/browser/ui/mouseCursor/mouseCursor.js';
|
|
18
19
|
export class MouseHandler extends ViewEventHandler {
|
|
19
20
|
constructor(context, viewController, viewHelper) {
|
|
20
21
|
super();
|
|
@@ -189,9 +190,14 @@ export class MouseHandler extends ViewEventHandler {
|
|
|
189
190
|
// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
193
|
+
const target = this._createMouseTarget(e, true);
|
|
194
|
+
// Show the text cursor where a click in the margin places the cursor (see `MouseTargetFactory._hitTestMargin`)
|
|
195
|
+
const options = this._context.configuration.options;
|
|
196
|
+
const isContentInMargin = target.type === 7 /* MouseTargetType.CONTENT_EMPTY */ && e.relativePos.x < options.get(169 /* EditorOption.layoutInfo */).contentLeft;
|
|
197
|
+
this.viewHelper.marginDomNode.classList.toggle(MOUSE_CURSOR_TEXT_CSS_CLASS_NAME, isContentInMargin && options.get(83 /* EditorOption.mouseStyle */) === 'text');
|
|
192
198
|
this.viewController.emitMouseMove({
|
|
193
199
|
event: e,
|
|
194
|
-
target
|
|
200
|
+
target
|
|
195
201
|
});
|
|
196
202
|
}
|
|
197
203
|
_onMouseLeave(e) {
|
|
@@ -199,6 +205,7 @@ export class MouseHandler extends ViewEventHandler {
|
|
|
199
205
|
this._mouseLeaveMonitor.dispose();
|
|
200
206
|
this._mouseLeaveMonitor = null;
|
|
201
207
|
}
|
|
208
|
+
this.viewHelper.marginDomNode.classList.remove(MOUSE_CURSOR_TEXT_CSS_CLASS_NAME);
|
|
202
209
|
this.lastMouseLeaveTime = (new Date()).getTime();
|
|
203
210
|
this.viewController.emitMouseLeave({
|
|
204
211
|
event: e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/mouseHandler.ts","vs/editor/browser/controller/mouseHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAe,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAgC,MAAM,kBAAkB,CAAC;AAEjH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAE5L,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAI3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AAyB,EAAE,oBAA8B;QAC3E,oJAAoJ;QACpJ,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,WAAW,GAAG,IAAI,CAAC,0BAA0B,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAC;YAChG,iBAAiB,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,0BAA0B,GAAG,WAAW,CAAC;QAE9C,iKAAiK;QACjK,IAAI,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;YACtD,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QAClD,CAAC;QAED,uEAAuE;QACvE,IAAI,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC7F,IAAI,CAAC,gCAAgC,EAAE,CAAC;QACzC,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,gCAAgC,GAAG,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,sBAAsB,GAAG,oBAAoB,CAAC;QAEnD,qCAAqC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAC/F,CAAC","file":"mouseHandler.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../base/browser/dom.js';\nimport { StandardWheelEvent, IMouseWheelEvent } from '../../../base/browser/mouseEvent.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { HitTestContext, MouseTarget, MouseTargetFactory, PointerHandlerLastRenderData } from './mouseTarget.js';\nimport { IMouseTarget, IMouseTargetViewZoneData, MouseTargetType } from '../editorBrowser.js';\nimport { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorPointerMoveMonitor, createEditorPagePosition, createCoordinatesRelativeToEditor } from '../editorDom.js';\nimport { ViewController } from '../view/viewController.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { Position } from '../../common/core/position.js';\nimport { Selection } from '../../common/core/selection.js';\nimport { HorizontalPosition } from '../view/renderingContext.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../common/viewEvents.js';\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { MouseWheelClassifier } from '../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { ViewLinesGpu } from '../viewParts/viewLinesGpu/viewLinesGpu.js';\nimport { TopBottomDragScrolling, LeftRightDragScrolling } from './dragScrolling.js';\nimport { TextDirection } from '../../common/model.js';\n\nexport interface IPointerHandlerHelper {\n\tviewDomNode: HTMLElement;\n\tlinesContentDomNode: HTMLElement;\n\tviewLinesDomNode: HTMLElement;\n\tviewLinesGpu: ViewLinesGpu | undefined;\n\n\tfocusTextArea(): void;\n\tdispatchTextAreaEvent(event: CustomEvent): void;\n\n\t/**\n\t * Get the last rendered information for cursors & textarea.\n\t */\n\tgetLastRenderData(): PointerHandlerLastRenderData;\n\n\t/**\n\t * Render right now\n\t */\n\trenderNow(): void;\n\n\tshouldSuppressMouseDownOnViewZone(viewZoneId: string): boolean;\n\tshouldSuppressMouseDownOnWidget(widgetId: string): boolean;\n\n\t/**\n\t * Decode a position from a rendered dom node\n\t */\n\tgetPositionFromDOMInfo(spanNode: HTMLElement, offset: number): Position | null;\n\n\tvisibleRangeForPosition(lineNumber: number, column: number): HorizontalPosition | null;\n\tgetLineWidth(lineNumber: number): number;\n}\n\nexport class MouseHandler extends ViewEventHandler {\n\n\tprotected _context: ViewContext;\n\tprotected viewController: ViewController;\n\tprotected viewHelper: IPointerHandlerHelper;\n\tprotected mouseTargetFactory: MouseTargetFactory;\n\tprotected readonly _mouseDownOperation: MouseDownOperation;\n\tprivate lastMouseLeaveTime: number;\n\tprivate _height: number;\n\tprivate _mouseLeaveMonitor: IDisposable | null = null;\n\n\tconstructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {\n\t\tsuper();\n\n\t\tthis._context = context;\n\t\tthis.viewController = viewController;\n\t\tthis.viewHelper = viewHelper;\n\t\tthis.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);\n\n\t\tthis._mouseDownOperation = this._register(new MouseDownOperation(\n\t\t\tthis._context,\n\t\t\tthis.viewController,\n\t\t\tthis.viewHelper,\n\t\t\tthis.mouseTargetFactory,\n\t\t\t(e, testEventTarget) => this._createMouseTarget(e, testEventTarget),\n\t\t\t(e) => this._getMouseColumn(e)\n\t\t));\n\n\t\tthis.lastMouseLeaveTime = -1;\n\t\tthis._height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\n\t\tconst mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);\n\n\t\tthis._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));\n\n\t\tthis._register(mouseEvents.onMouseMove(this.viewHelper.viewDomNode, (e) => {\n\t\t\tthis._onMouseMove(e);\n\n\t\t\t// See https://github.com/microsoft/vscode/issues/138789\n\t\t\t// When moving the mouse really quickly, the browser sometimes forgets to\n\t\t\t// send us a `mouseleave` or `mouseout` event. We therefore install here\n\t\t\t// a global `mousemove` listener to manually recover if the mouse goes outside\n\t\t\t// the editor. As soon as the mouse leaves outside of the editor, we\n\t\t\t// remove this listener\n\n\t\t\tif (!this._mouseLeaveMonitor) {\n\t\t\t\tthis._mouseLeaveMonitor = dom.addDisposableListener(this.viewHelper.viewDomNode.ownerDocument, 'mousemove', (e) => {\n\t\t\t\t\tif (!this.viewHelper.viewDomNode.contains(e.target as Node | null)) {\n\t\t\t\t\t\t// went outside the editor!\n\t\t\t\t\t\tthis._onMouseLeave(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n\n\t\tthis._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n\n\t\t// `pointerdown` events can't be used to determine if there's a double click, or triple click\n\t\t// because their `e.detail` is always 0.\n\t\t// We will therefore save the pointer id for the mouse and then reuse it in the `mousedown` event\n\t\t// for `element.setPointerCapture`.\n\t\tlet capturePointerId: number = 0;\n\t\tthis._register(mouseEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => {\n\t\t\tcapturePointerId = pointerId;\n\t\t}));\n\t\t// The `pointerup` listener registered by `GlobalEditorPointerMoveMonitor` does not get invoked 100% of the times.\n\t\t// I speculate that this is because the `pointerup` listener is only registered during the `mousedown` event, and perhaps\n\t\t// the `pointerup` event is already queued for dispatching, which makes it that the new listener doesn't get fired.\n\t\t// See https://github.com/microsoft/vscode/issues/146486 for repro steps.\n\t\t// To compensate for that, we simply register here a `pointerup` listener and just communicate it.\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.POINTER_UP, (e: PointerEvent) => {\n\t\t\tthis._mouseDownOperation.onPointerUp();\n\t\t}));\n\t\tthis._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId)));\n\t\tthis._setupMouseWheelZoomListener();\n\n\t\tthis._context.addEventHandler(this);\n\t}\n\n\tprivate _setupMouseWheelZoomListener(): void {\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\n\t\tlet prevMouseWheelTime = 0;\n\t\tlet gestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\tlet gestureHasZoomModifiers = false;\n\t\tlet gestureAccumulatedDelta = 0;\n\n\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\tthis.viewController.emitMouseWheel(browserEvent);\n\n\t\t\tif (!this._context.configuration.options.get(EditorOption.mouseWheelZoom)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst e = new StandardWheelEvent(browserEvent);\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\n\t\t\tif (classifier.isPhysicalMouseWheel()) {\n\t\t\t\tif (hasMouseWheelZoomModifiers(browserEvent)) {\n\t\t\t\t\tconst zoomLevel: number = EditorZoom.getZoomLevel();\n\t\t\t\t\tconst delta = e.deltaY > 0 ? 1 : -1;\n\t\t\t\t\tEditorZoom.setZoomLevel(zoomLevel + delta);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we consider mousewheel events that occur within 50ms of each other to be part of the same gesture\n\t\t\t\t// we don't want to consider mouse wheel events where ctrl/cmd is pressed during the inertia phase\n\t\t\t\t// we also want to accumulate deltaY values from the same gesture and use that to set the zoom level\n\t\t\t\tif (Date.now() - prevMouseWheelTime > 50) {\n\t\t\t\t\t// reset if more than 50ms have passed\n\t\t\t\t\tgestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\t\t\t\tgestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent);\n\t\t\t\t\tgestureAccumulatedDelta = 0;\n\t\t\t\t}\n\n\t\t\t\tprevMouseWheelTime = Date.now();\n\t\t\t\tgestureAccumulatedDelta += e.deltaY;\n\n\t\t\t\tif (gestureHasZoomModifiers) {\n\t\t\t\t\tEditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));\n\n\t\tfunction hasMouseWheelZoomModifiers(browserEvent: IMouseWheelEvent): boolean {\n\t\t\treturn (\n\t\t\t\tplatform.isMacintosh\n\t\t\t\t\t// on macOS we support cmd + two fingers scroll (`metaKey` set)\n\t\t\t\t\t// and also the two fingers pinch gesture (`ctrKey` set)\n\t\t\t\t\t? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t\t\t: (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._context.removeEventHandler(this);\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t// --- begin event handlers\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\t// layout change\n\t\t\tconst height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\t\t\tif (this._height !== height) {\n\t\t\t\tthis._height = height;\n\t\t\t\tthis._mouseDownOperation.onHeightChanged();\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tpublic override onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {\n\t\tthis._mouseDownOperation.onCursorStateChanged(e);\n\t\treturn false;\n\t}\n\tpublic override onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean {\n\t\treturn false;\n\t}\n\t// --- end event handlers\n\n\tpublic getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null {\n\t\tconst clientPos = new ClientCoordinates(clientX, clientY);\n\t\tconst pos = clientPos.toPageCoordinates(dom.getWindow(this.viewHelper.viewDomNode));\n\t\tconst editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);\n\n\t\tif (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst relativePos = createCoordinatesRelativeToEditor(this.viewHelper.viewDomNode, editorPos, pos);\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t}\n\n\tprotected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget {\n\t\tlet target: HTMLElement | null = e.target;\n\t\tif (!this.viewHelper.viewDomNode.contains(target)) {\n\t\t\tconst shadowRoot = dom.getShadowRoot(this.viewHelper.viewDomNode);\n\t\t\tif (shadowRoot) {\n\t\t\t\tconst potentialTarget = shadowRoot.elementsFromPoint(e.posx, e.posy).find(\n\t\t\t\t\t(el: Element) => this.viewHelper.viewDomNode.contains(el)\n\t\t\t\t) ?? null;\n\t\t\t\ttarget = potentialTarget as HTMLElement;\n\t\t\t}\n\t\t}\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, e.relativePos, testEventTarget ? target : null);\n\t}\n\n\tprivate _getMouseColumn(e: EditorMouseEvent): number {\n\t\treturn this.mouseTargetFactory.getMouseColumn(e.relativePos);\n\t}\n\n\tprotected _onContextMenu(e: EditorMouseEvent, testEventTarget: boolean): void {\n\t\tthis.viewController.emitContextMenu({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, testEventTarget)\n\t\t});\n\t}\n\n\tprotected _onMouseMove(e: EditorMouseEvent): void {\n\t\tconst targetIsWidget = this.mouseTargetFactory.mouseTargetIsWidget(e);\n\t\tif (!targetIsWidget) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tif (this._mouseDownOperation.isActive()) {\n\t\t\t// In selection/drag operation\n\t\t\treturn;\n\t\t}\n\t\tconst actualMouseMoveTime = e.timestamp;\n\t\tif (actualMouseMoveTime < this.lastMouseLeaveTime) {\n\t\t\t// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.\n\t\t\treturn;\n\t\t}\n\n\t\tthis.viewController.emitMouseMove({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, true)\n\t\t});\n\t}\n\n\tprotected _onMouseLeave(e: EditorMouseEvent): void {\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tthis.lastMouseLeaveTime = (new Date()).getTime();\n\t\tthis.viewController.emitMouseLeave({\n\t\t\tevent: e,\n\t\t\ttarget: null\n\t\t});\n\t}\n\n\tprotected _onMouseUp(e: EditorMouseEvent): void {\n\t\tthis.viewController.emitMouseUp({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, true)\n\t\t});\n\t}\n\n\tprotected _onMouseDown(e: EditorMouseEvent, pointerId: number): void {\n\t\tconst t = this._createMouseTarget(e, true);\n\n\t\tconst targetIsContent = (t.type === MouseTargetType.CONTENT_TEXT || t.type === MouseTargetType.CONTENT_EMPTY);\n\t\tconst targetIsGutter = (t.type === MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === MouseTargetType.GUTTER_LINE_NUMBERS || t.type === MouseTargetType.GUTTER_LINE_DECORATIONS);\n\t\tconst targetIsLineNumbers = (t.type === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tconst selectOnLineNumbers = this._context.configuration.options.get(EditorOption.selectOnLineNumbers);\n\t\tconst targetIsViewZone = (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE);\n\t\tconst targetIsWidget = (t.type === MouseTargetType.CONTENT_WIDGET);\n\n\t\tlet shouldHandle = e.leftButton || e.middleButton;\n\t\tif (platform.isMacintosh && e.leftButton && e.ctrlKey) {\n\t\t\tshouldHandle = false;\n\t\t}\n\n\t\tconst focus = () => {\n\t\t\te.preventDefault();\n\t\t\tthis.viewHelper.focusTextArea();\n\t\t};\n\n\t\tif (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {\n\t\t\tfocus();\n\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\n\t\t} else if (targetIsGutter) {\n\t\t\t// Do not steal focus\n\t\t\te.preventDefault();\n\t\t} else if (targetIsViewZone) {\n\t\t\tconst viewZoneData = t.detail;\n\t\t\tif (shouldHandle && this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {\n\t\t\t\tfocus();\n\t\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t} else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {\n\t\t\tfocus();\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tthis.viewController.emitMouseDown({\n\t\t\tevent: e,\n\t\t\ttarget: t\n\t\t});\n\t}\n}\n\nclass MouseDownOperation extends Disposable {\n\n\tprivate readonly _createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget;\n\tprivate readonly _getMouseColumn: (e: EditorMouseEvent) => number;\n\n\tprivate readonly _mouseMoveMonitor: GlobalEditorPointerMoveMonitor;\n\tprivate readonly _topBottomDragScrolling: TopBottomDragScrolling;\n\tprivate readonly _leftRightDragScrolling: LeftRightDragScrolling;\n\tprivate readonly _mouseState: MouseDownState;\n\n\tprivate _currentSelection: Selection;\n\tprivate _isActive: boolean;\n\tprivate _lastMouseEvent: EditorMouseEvent | null;\n\n\tconstructor(\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\tprivate readonly _viewHelper: IPointerHandlerHelper,\n\t\tprivate readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tcreateMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget,\n\t\tgetMouseColumn: (e: EditorMouseEvent) => number\n\t) {\n\t\tsuper();\n\t\tthis._createMouseTarget = createMouseTarget;\n\t\tthis._getMouseColumn = getMouseColumn;\n\n\t\tthis._mouseMoveMonitor = this._register(new GlobalEditorPointerMoveMonitor(this._viewHelper.viewDomNode));\n\t\tthis._topBottomDragScrolling = this._register(new TopBottomDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._leftRightDragScrolling = this._register(new LeftRightDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._mouseState = new MouseDownState();\n\n\t\tthis._currentSelection = new Selection(1, 1, 1, 1);\n\t\tthis._isActive = false;\n\t\tthis._lastMouseEvent = null;\n\t}\n\n\tpublic isActive(): boolean {\n\t\treturn this._isActive;\n\t}\n\n\tprivate _onMouseDownThenMove(e: EditorMouseEvent): void {\n\t\tthis._lastMouseEvent = e;\n\t\tthis._mouseState.setModifiers(e);\n\n\t\tconst position = this._findMousePosition(e, false);\n\t\tif (!position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._mouseState.isDragAndDrop) {\n\t\t\tthis._viewController.emitMouseDrag({\n\t\t\t\tevent: e,\n\t\t\t\ttarget: position\n\t\t\t});\n\t\t} else {\n\t\t\tif (position.type === MouseTargetType.OUTSIDE_EDITOR) {\n\t\t\t\tif (position.outsidePosition === 'above' || position.outsidePosition === 'below') {\n\t\t\t\t\tthis._topBottomDragScrolling.start(position, e);\n\t\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\t} else {\n\t\t\t\t\tthis._leftRightDragScrolling.start(position, e);\n\t\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\tthis._dispatchMouse(position, true, NavigationCommandRevealType.Minimal);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic start(targetType: MouseTargetType, e: EditorMouseEvent, pointerId: number): void {\n\t\tthis._lastMouseEvent = e;\n\n\t\tthis._mouseState.setStartedOnLineNumbers(targetType === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tthis._mouseState.setStartButtons(e);\n\t\tthis._mouseState.setModifiers(e);\n\t\tconst position = this._findMousePosition(e, true);\n\t\tif (!position || !position.position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.trySetCount(e.detail, position.position);\n\n\t\t// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.\n\t\te.detail = this._mouseState.count;\n\n\t\tconst options = this._context.configuration.options;\n\n\t\tif (!options.get(EditorOption.readOnly)\n\t\t\t&& options.get(EditorOption.dragAndDrop)\n\t\t\t&& !options.get(EditorOption.columnSelection)\n\t\t\t&& !this._mouseState.altKey // we don't support multiple mouse\n\t\t\t&& e.detail < 2 // only single click on a selection can work\n\t\t\t&& !this._isActive // the mouse is not down yet\n\t\t\t&& !this._currentSelection.isEmpty() // we don't drag single cursor\n\t\t\t&& (position.type === MouseTargetType.CONTENT_TEXT) // single click on text\n\t\t\t&& position.position && this._currentSelection.containsPosition(position.position) // single click on a selection\n\t\t) {\n\t\t\tthis._mouseState.isDragAndDrop = true;\n\t\t\tthis._isActive = true;\n\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t(browserEvent?: MouseEvent | KeyboardEvent) => {\n\t\t\t\t\tconst position = this._findMousePosition(this._lastMouseEvent!, false);\n\n\t\t\t\t\tif (dom.isKeyboardEvent(browserEvent)) {\n\t\t\t\t\t\t// cancel\n\t\t\t\t\t\tthis._viewController.emitMouseDropCanceled();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._viewController.emitMouseDrop({\n\t\t\t\t\t\t\tevent: this._lastMouseEvent!,\n\t\t\t\t\t\t\ttarget: (position ? this._createMouseTarget(this._lastMouseEvent!, true) : null) // Ignoring because position is unknown, e.g., Content View Zone\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._stop();\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.isDragAndDrop = false;\n\t\tthis._dispatchMouse(position, e.shiftKey, NavigationCommandRevealType.Minimal);\n\n\t\tif (!this._isActive) {\n\t\t\tthis._isActive = true;\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t() => this._stop()\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _stop(): void {\n\t\tthis._isActive = false;\n\t\tthis._topBottomDragScrolling.stop();\n\t\tthis._leftRightDragScrolling.stop();\n\t}\n\n\tpublic onHeightChanged(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onPointerUp(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): void {\n\t\tthis._currentSelection = e.selections[0];\n\t}\n\n\tprivate _getPositionOutsideEditor(e: EditorMouseEvent): IMouseTarget | null {\n\t\tconst editorContent = e.editorPos;\n\t\tconst model = this._context.viewModel;\n\t\tconst viewLayout = this._context.viewLayout;\n\n\t\tconst mouseColumn = this._getMouseColumn(e);\n\n\t\tif (e.posy < editorContent.y) {\n\t\t\tconst outsideDistance = editorContent.y - e.posy;\n\t\t\tconst verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - outsideDistance, 0);\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'above', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(aboveLineNumber, 1), 'above', outsideDistance);\n\t\t}\n\n\t\tif (e.posy > editorContent.y + editorContent.height) {\n\t\t\tconst outsideDistance = e.posy - editorContent.y - editorContent.height;\n\t\t\tconst verticalOffset = viewLayout.getCurrentScrollTop() + e.relativePos.y;\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'below', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)), 'below', outsideDistance);\n\t\t}\n\n\t\tconst possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + e.relativePos.y);\n\n\t\tconst layoutInfo = this._context.configuration.options.get(EditorOption.layoutInfo);\n\n\t\tconst xLeftBoundary = layoutInfo.contentLeft;\n\t\tif (e.relativePos.x <= xLeftBoundary) {\n\t\t\tconst outsideDistance = xLeftBoundary - e.relativePos.x;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? model.getLineMaxColumn(possibleLineNumber) : 1), 'left', outsideDistance);\n\t\t}\n\n\t\tconst contentRight = (\n\t\t\tlayoutInfo.minimap.minimapLeft === 0\n\t\t\t\t? layoutInfo.width - layoutInfo.verticalScrollbarWidth // Happens when minimap is hidden\n\t\t\t\t: layoutInfo.minimap.minimapLeft\n\t\t);\n\t\tconst xRightBoundary = contentRight;\n\t\tif (e.relativePos.x >= xRightBoundary) {\n\t\t\tconst outsideDistance = e.relativePos.x - xRightBoundary;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? 1 : model.getLineMaxColumn(possibleLineNumber)), 'right', outsideDistance);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate _findMousePosition(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget | null {\n\t\tconst positionOutsideEditor = this._getPositionOutsideEditor(e);\n\t\tif (positionOutsideEditor) {\n\t\t\treturn positionOutsideEditor;\n\t\t}\n\n\t\tconst t = this._createMouseTarget(e, testEventTarget);\n\t\tconst hintedPosition = t.position;\n\t\tif (!hintedPosition) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE) {\n\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(t.detail);\n\t\t\tif (newPosition) {\n\t\t\t\treturn MouseTarget.createViewZone(t.type, t.element, t.mouseColumn, newPosition, t.detail);\n\t\t\t}\n\t\t}\n\n\t\treturn t;\n\t}\n\n\tprivate _helpPositionJumpOverViewZone(viewZoneData: IMouseTargetViewZoneData): Position | null {\n\t\t// Force position on view zones to go above or below depending on where selection started from\n\t\tconst selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);\n\t\tconst positionBefore = viewZoneData.positionBefore;\n\t\tconst positionAfter = viewZoneData.positionAfter;\n\n\t\tif (positionBefore && positionAfter) {\n\t\t\tif (positionBefore.isBefore(selectionStart)) {\n\t\t\t\treturn positionBefore;\n\t\t\t} else {\n\t\t\t\treturn positionAfter;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate _dispatchMouse(position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType): void {\n\t\tif (!position.position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._viewController.dispatchMouse({\n\t\t\tposition: position.position,\n\t\t\tmouseColumn: position.mouseColumn,\n\t\t\tstartedOnLineNumbers: this._mouseState.startedOnLineNumbers,\n\t\t\trevealType,\n\n\t\t\tinSelectionMode: inSelectionMode,\n\t\t\tmouseDownCount: this._mouseState.count,\n\t\t\taltKey: this._mouseState.altKey,\n\t\t\tctrlKey: this._mouseState.ctrlKey,\n\t\t\tmetaKey: this._mouseState.metaKey,\n\t\t\tshiftKey: this._mouseState.shiftKey,\n\n\t\t\tleftButton: this._mouseState.leftButton,\n\t\t\tmiddleButton: this._mouseState.middleButton,\n\n\t\t\tonInjectedText: position.type === MouseTargetType.CONTENT_TEXT && position.detail.injectedText !== null\n\t\t});\n\t}\n}\n\nclass MouseDownState {\n\n\tprivate static readonly CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms\n\n\tprivate _altKey: boolean;\n\tpublic get altKey(): boolean { return this._altKey; }\n\n\tprivate _ctrlKey: boolean;\n\tpublic get ctrlKey(): boolean { return this._ctrlKey; }\n\n\tprivate _metaKey: boolean;\n\tpublic get metaKey(): boolean { return this._metaKey; }\n\n\tprivate _shiftKey: boolean;\n\tpublic get shiftKey(): boolean { return this._shiftKey; }\n\n\tprivate _leftButton: boolean;\n\tpublic get leftButton(): boolean { return this._leftButton; }\n\n\tprivate _middleButton: boolean;\n\tpublic get middleButton(): boolean { return this._middleButton; }\n\n\tprivate _startedOnLineNumbers: boolean;\n\tpublic get startedOnLineNumbers(): boolean { return this._startedOnLineNumbers; }\n\n\tprivate _lastMouseDownPosition: Position | null;\n\tprivate _lastMouseDownPositionEqualCount: number;\n\tprivate _lastMouseDownCount: number;\n\tprivate _lastSetMouseDownCountTime: number;\n\tpublic isDragAndDrop: boolean;\n\n\tconstructor() {\n\t\tthis._altKey = false;\n\t\tthis._ctrlKey = false;\n\t\tthis._metaKey = false;\n\t\tthis._shiftKey = false;\n\t\tthis._leftButton = false;\n\t\tthis._middleButton = false;\n\t\tthis._startedOnLineNumbers = false;\n\t\tthis._lastMouseDownPosition = null;\n\t\tthis._lastMouseDownPositionEqualCount = 0;\n\t\tthis._lastMouseDownCount = 0;\n\t\tthis._lastSetMouseDownCountTime = 0;\n\t\tthis.isDragAndDrop = false;\n\t}\n\n\tpublic get count(): number {\n\t\treturn this._lastMouseDownCount;\n\t}\n\n\tpublic setModifiers(source: EditorMouseEvent) {\n\t\tthis._altKey = source.altKey;\n\t\tthis._ctrlKey = source.ctrlKey;\n\t\tthis._metaKey = source.metaKey;\n\t\tthis._shiftKey = source.shiftKey;\n\t}\n\n\tpublic setStartButtons(source: EditorMouseEvent) {\n\t\tthis._leftButton = source.leftButton;\n\t\tthis._middleButton = source.middleButton;\n\t}\n\n\tpublic setStartedOnLineNumbers(startedOnLineNumbers: boolean): void {\n\t\tthis._startedOnLineNumbers = startedOnLineNumbers;\n\t}\n\n\tpublic trySetCount(setMouseDownCount: number, newMouseDownPosition: Position): void {\n\t\t// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tconst currentTime = (new Date()).getTime();\n\t\tif (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {\n\t\t\tsetMouseDownCount = 1;\n\t\t}\n\t\tthis._lastSetMouseDownCountTime = currentTime;\n\n\t\t// b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tif (setMouseDownCount > this._lastMouseDownCount + 1) {\n\t\t\tsetMouseDownCount = this._lastMouseDownCount + 1;\n\t\t}\n\n\t\t// c. Invalidate multiple clicking if the logical position is different\n\t\tif (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {\n\t\t\tthis._lastMouseDownPositionEqualCount++;\n\t\t} else {\n\t\t\tthis._lastMouseDownPositionEqualCount = 1;\n\t\t}\n\t\tthis._lastMouseDownPosition = newMouseDownPosition;\n\n\t\t// Finally set the lastMouseDownCount\n\t\tthis._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../base/browser/dom.js';\nimport { StandardWheelEvent, IMouseWheelEvent } from '../../../base/browser/mouseEvent.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { HitTestContext, MouseTarget, MouseTargetFactory, PointerHandlerLastRenderData } from './mouseTarget.js';\nimport { IMouseTarget, IMouseTargetViewZoneData, MouseTargetType } from '../editorBrowser.js';\nimport { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorPointerMoveMonitor, createEditorPagePosition, createCoordinatesRelativeToEditor } from '../editorDom.js';\nimport { ViewController } from '../view/viewController.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { Position } from '../../common/core/position.js';\nimport { Selection } from '../../common/core/selection.js';\nimport { HorizontalPosition } from '../view/renderingContext.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../common/viewEvents.js';\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { MouseWheelClassifier } from '../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { ViewLinesGpu } from '../viewParts/viewLinesGpu/viewLinesGpu.js';\nimport { TopBottomDragScrolling, LeftRightDragScrolling } from './dragScrolling.js';\nimport { TextDirection } from '../../common/model.js';\n\nexport interface IPointerHandlerHelper {\n\tviewDomNode: HTMLElement;\n\tlinesContentDomNode: HTMLElement;\n\tviewLinesDomNode: HTMLElement;\n\tviewLinesGpu: ViewLinesGpu | undefined;\n\n\tfocusTextArea(): void;\n\tdispatchTextAreaEvent(event: CustomEvent): void;\n\n\t/**\n\t * Get the last rendered information for cursors & textarea.\n\t */\n\tgetLastRenderData(): PointerHandlerLastRenderData;\n\n\t/**\n\t * Render right now\n\t */\n\trenderNow(): void;\n\n\tshouldSuppressMouseDownOnViewZone(viewZoneId: string): boolean;\n\tshouldSuppressMouseDownOnWidget(widgetId: string): boolean;\n\n\t/**\n\t * Decode a position from a rendered dom node\n\t */\n\tgetPositionFromDOMInfo(spanNode: HTMLElement, offset: number): Position | null;\n\n\tvisibleRangeForPosition(lineNumber: number, column: number): HorizontalPosition | null;\n\tgetLineWidth(lineNumber: number): number;\n}\n\nexport class MouseHandler extends ViewEventHandler {\n\n\tprotected _context: ViewContext;\n\tprotected viewController: ViewController;\n\tprotected viewHelper: IPointerHandlerHelper;\n\tprotected mouseTargetFactory: MouseTargetFactory;\n\tprotected readonly _mouseDownOperation: MouseDownOperation;\n\tprivate lastMouseLeaveTime: number;\n\tprivate _height: number;\n\tprivate _mouseLeaveMonitor: IDisposable | null = null;\n\n\tconstructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {\n\t\tsuper();\n\n\t\tthis._context = context;\n\t\tthis.viewController = viewController;\n\t\tthis.viewHelper = viewHelper;\n\t\tthis.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);\n\n\t\tthis._mouseDownOperation = this._register(new MouseDownOperation(\n\t\t\tthis._context,\n\t\t\tthis.viewController,\n\t\t\tthis.viewHelper,\n\t\t\tthis.mouseTargetFactory,\n\t\t\t(e, testEventTarget) => this._createMouseTarget(e, testEventTarget),\n\t\t\t(e) => this._getMouseColumn(e)\n\t\t));\n\n\t\tthis.lastMouseLeaveTime = -1;\n\t\tthis._height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\n\t\tconst mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);\n\n\t\tthis._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));\n\n\t\tthis._register(mouseEvents.onMouseMove(this.viewHelper.viewDomNode, (e) => {\n\t\t\tthis._onMouseMove(e);\n\n\t\t\t// See https://github.com/microsoft/vscode/issues/138789\n\t\t\t// When moving the mouse really quickly, the browser sometimes forgets to\n\t\t\t// send us a `mouseleave` or `mouseout` event. We therefore install here\n\t\t\t// a global `mousemove` listener to manually recover if the mouse goes outside\n\t\t\t// the editor. As soon as the mouse leaves outside of the editor, we\n\t\t\t// remove this listener\n\n\t\t\tif (!this._mouseLeaveMonitor) {\n\t\t\t\tthis._mouseLeaveMonitor = dom.addDisposableListener(this.viewHelper.viewDomNode.ownerDocument, 'mousemove', (e) => {\n\t\t\t\t\tif (!this.viewHelper.viewDomNode.contains(e.target as Node | null)) {\n\t\t\t\t\t\t// went outside the editor!\n\t\t\t\t\t\tthis._onMouseLeave(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n\n\t\tthis._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n\n\t\t// `pointerdown` events can't be used to determine if there's a double click, or triple click\n\t\t// because their `e.detail` is always 0.\n\t\t// We will therefore save the pointer id for the mouse and then reuse it in the `mousedown` event\n\t\t// for `element.setPointerCapture`.\n\t\tlet capturePointerId: number = 0;\n\t\tthis._register(mouseEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => {\n\t\t\tcapturePointerId = pointerId;\n\t\t}));\n\t\t// The `pointerup` listener registered by `GlobalEditorPointerMoveMonitor` does not get invoked 100% of the times.\n\t\t// I speculate that this is because the `pointerup` listener is only registered during the `mousedown` event, and perhaps\n\t\t// the `pointerup` event is already queued for dispatching, which makes it that the new listener doesn't get fired.\n\t\t// See https://github.com/microsoft/vscode/issues/146486 for repro steps.\n\t\t// To compensate for that, we simply register here a `pointerup` listener and just communicate it.\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.POINTER_UP, (e: PointerEvent) => {\n\t\t\tthis._mouseDownOperation.onPointerUp();\n\t\t}));\n\t\tthis._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId)));\n\t\tthis._setupMouseWheelZoomListener();\n\n\t\tthis._context.addEventHandler(this);\n\t}\n\n\tprivate _setupMouseWheelZoomListener(): void {\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\n\t\tlet prevMouseWheelTime = 0;\n\t\tlet gestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\tlet gestureHasZoomModifiers = false;\n\t\tlet gestureAccumulatedDelta = 0;\n\n\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\tthis.viewController.emitMouseWheel(browserEvent);\n\n\t\t\tif (!this._context.configuration.options.get(EditorOption.mouseWheelZoom)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst e = new StandardWheelEvent(browserEvent);\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\n\t\t\tif (classifier.isPhysicalMouseWheel()) {\n\t\t\t\tif (hasMouseWheelZoomModifiers(browserEvent)) {\n\t\t\t\t\tconst zoomLevel: number = EditorZoom.getZoomLevel();\n\t\t\t\t\tconst delta = e.deltaY > 0 ? 1 : -1;\n\t\t\t\t\tEditorZoom.setZoomLevel(zoomLevel + delta);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we consider mousewheel events that occur within 50ms of each other to be part of the same gesture\n\t\t\t\t// we don't want to consider mouse wheel events where ctrl/cmd is pressed during the inertia phase\n\t\t\t\t// we also want to accumulate deltaY values from the same gesture and use that to set the zoom level\n\t\t\t\tif (Date.now() - prevMouseWheelTime > 50) {\n\t\t\t\t\t// reset if more than 50ms have passed\n\t\t\t\t\tgestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\t\t\t\tgestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent);\n\t\t\t\t\tgestureAccumulatedDelta = 0;\n\t\t\t\t}\n\n\t\t\t\tprevMouseWheelTime = Date.now();\n\t\t\t\tgestureAccumulatedDelta += e.deltaY;\n\n\t\t\t\tif (gestureHasZoomModifiers) {\n\t\t\t\t\tEditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));\n\n\t\tfunction hasMouseWheelZoomModifiers(browserEvent: IMouseWheelEvent): boolean {\n\t\t\treturn (\n\t\t\t\tplatform.isMacintosh\n\t\t\t\t\t// on macOS we support cmd + two fingers scroll (`metaKey` set)\n\t\t\t\t\t// and also the two fingers pinch gesture (`ctrKey` set)\n\t\t\t\t\t? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t\t\t: (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._context.removeEventHandler(this);\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t// --- begin event handlers\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\t// layout change\n\t\t\tconst height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\t\t\tif (this._height !== height) {\n\t\t\t\tthis._height = height;\n\t\t\t\tthis._mouseDownOperation.onHeightChanged();\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tpublic override onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {\n\t\tthis._mouseDownOperation.onCursorStateChanged(e);\n\t\treturn false;\n\t}\n\tpublic override onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean {\n\t\treturn false;\n\t}\n\t// --- end event handlers\n\n\tpublic getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null {\n\t\tconst clientPos = new ClientCoordinates(clientX, clientY);\n\t\tconst pos = clientPos.toPageCoordinates(dom.getWindow(this.viewHelper.viewDomNode));\n\t\tconst editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);\n\n\t\tif (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst relativePos = createCoordinatesRelativeToEditor(this.viewHelper.viewDomNode, editorPos, pos);\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t}\n\n\tprotected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget {\n\t\tlet target: HTMLElement | null = e.target;\n\t\tif (!this.viewHelper.viewDomNode.contains(target)) {\n\t\t\tconst shadowRoot = dom.getShadowRoot(this.viewHelper.viewDomNode);\n\t\t\tif (shadowRoot) {\n\t\t\t\tconst potentialTarget = shadowRoot.elementsFromPoint(e.posx, e.posy).find(\n\t\t\t\t\t(el: Element) => this.viewHelper.viewDomNode.contains(el)\n\t\t\t\t) ?? null;\n\t\t\t\ttarget = potentialTarget as HTMLElement;\n\t\t\t}\n\t\t}\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, e.relativePos, testEventTarget ? target : null);\n\t}\n\n\tprivate _getMouseColumn(e: EditorMouseEvent): number {\n\t\treturn this.mouseTargetFactory.getMouseColumn(e.relativePos);\n\t}\n\n\tprotected _onContextMenu(e: EditorMouseEvent, testEventTarget: boolean): void {\n\t\tthis.viewController.emitContextMenu({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, testEventTarget)\n\t\t});\n\t}\n\n\tprotected _onMouseMove(e: EditorMouseEvent): void {\n\t\tconst targetIsWidget = this.mouseTargetFactory.mouseTargetIsWidget(e);\n\t\tif (!targetIsWidget) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tif (this._mouseDownOperation.isActive()) {\n\t\t\t// In selection/drag operation\n\t\t\treturn;\n\t\t}\n\t\tconst actualMouseMoveTime = e.timestamp;\n\t\tif (actualMouseMoveTime < this.lastMouseLeaveTime) {\n\t\t\t// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.\n\t\t\treturn;\n\t\t}\n\n\t\tthis.viewController.emitMouseMove({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, true)\n\t\t});\n\t}\n\n\tprotected _onMouseLeave(e: EditorMouseEvent): void {\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tthis.lastMouseLeaveTime = (new Date()).getTime();\n\t\tthis.viewController.emitMouseLeave({\n\t\t\tevent: e,\n\t\t\ttarget: null\n\t\t});\n\t}\n\n\tprotected _onMouseUp(e: EditorMouseEvent): void {\n\t\tthis.viewController.emitMouseUp({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, true)\n\t\t});\n\t}\n\n\tprotected _onMouseDown(e: EditorMouseEvent, pointerId: number): void {\n\t\tconst t = this._createMouseTarget(e, true);\n\n\t\tconst targetIsContent = (t.type === MouseTargetType.CONTENT_TEXT || t.type === MouseTargetType.CONTENT_EMPTY);\n\t\tconst targetIsGutter = (t.type === MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === MouseTargetType.GUTTER_LINE_NUMBERS || t.type === MouseTargetType.GUTTER_LINE_DECORATIONS);\n\t\tconst targetIsLineNumbers = (t.type === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tconst selectOnLineNumbers = this._context.configuration.options.get(EditorOption.selectOnLineNumbers);\n\t\tconst targetIsViewZone = (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE);\n\t\tconst targetIsWidget = (t.type === MouseTargetType.CONTENT_WIDGET);\n\n\t\tlet shouldHandle = e.leftButton || e.middleButton;\n\t\tif (platform.isMacintosh && e.leftButton && e.ctrlKey) {\n\t\t\tshouldHandle = false;\n\t\t}\n\n\t\tconst focus = () => {\n\t\t\te.preventDefault();\n\t\t\tthis.viewHelper.focusTextArea();\n\t\t};\n\n\t\tif (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {\n\t\t\tfocus();\n\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\n\t\t} else if (targetIsGutter) {\n\t\t\t// Do not steal focus\n\t\t\te.preventDefault();\n\t\t} else if (targetIsViewZone) {\n\t\t\tconst viewZoneData = t.detail;\n\t\t\tif (shouldHandle && this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {\n\t\t\t\tfocus();\n\t\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t} else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {\n\t\t\tfocus();\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tthis.viewController.emitMouseDown({\n\t\t\tevent: e,\n\t\t\ttarget: t\n\t\t});\n\t}\n}\n\nclass MouseDownOperation extends Disposable {\n\n\tprivate readonly _createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget;\n\tprivate readonly _getMouseColumn: (e: EditorMouseEvent) => number;\n\n\tprivate readonly _mouseMoveMonitor: GlobalEditorPointerMoveMonitor;\n\tprivate readonly _topBottomDragScrolling: TopBottomDragScrolling;\n\tprivate readonly _leftRightDragScrolling: LeftRightDragScrolling;\n\tprivate readonly _mouseState: MouseDownState;\n\n\tprivate _currentSelection: Selection;\n\tprivate _isActive: boolean;\n\tprivate _lastMouseEvent: EditorMouseEvent | null;\n\n\tconstructor(\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\tprivate readonly _viewHelper: IPointerHandlerHelper,\n\t\tprivate readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tcreateMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget,\n\t\tgetMouseColumn: (e: EditorMouseEvent) => number\n\t) {\n\t\tsuper();\n\t\tthis._createMouseTarget = createMouseTarget;\n\t\tthis._getMouseColumn = getMouseColumn;\n\n\t\tthis._mouseMoveMonitor = this._register(new GlobalEditorPointerMoveMonitor(this._viewHelper.viewDomNode));\n\t\tthis._topBottomDragScrolling = this._register(new TopBottomDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._leftRightDragScrolling = this._register(new LeftRightDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._mouseState = new MouseDownState();\n\n\t\tthis._currentSelection = new Selection(1, 1, 1, 1);\n\t\tthis._isActive = false;\n\t\tthis._lastMouseEvent = null;\n\t}\n\n\tpublic isActive(): boolean {\n\t\treturn this._isActive;\n\t}\n\n\tprivate _onMouseDownThenMove(e: EditorMouseEvent): void {\n\t\tthis._lastMouseEvent = e;\n\t\tthis._mouseState.setModifiers(e);\n\n\t\tconst position = this._findMousePosition(e, false);\n\t\tif (!position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._mouseState.isDragAndDrop) {\n\t\t\tthis._viewController.emitMouseDrag({\n\t\t\t\tevent: e,\n\t\t\t\ttarget: position\n\t\t\t});\n\t\t} else {\n\t\t\tif (position.type === MouseTargetType.OUTSIDE_EDITOR) {\n\t\t\t\tif (position.outsidePosition === 'above' || position.outsidePosition === 'below') {\n\t\t\t\t\tthis._topBottomDragScrolling.start(position, e);\n\t\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\t} else {\n\t\t\t\t\tthis._leftRightDragScrolling.start(position, e);\n\t\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\tthis._dispatchMouse(position, true, NavigationCommandRevealType.Minimal);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic start(targetType: MouseTargetType, e: EditorMouseEvent, pointerId: number): void {\n\t\tthis._lastMouseEvent = e;\n\n\t\tthis._mouseState.setStartedOnLineNumbers(targetType === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tthis._mouseState.setStartButtons(e);\n\t\tthis._mouseState.setModifiers(e);\n\t\tconst position = this._findMousePosition(e, true);\n\t\tif (!position || !position.position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.trySetCount(e.detail, position.position);\n\n\t\t// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.\n\t\te.detail = this._mouseState.count;\n\n\t\tconst options = this._context.configuration.options;\n\n\t\tif (!options.get(EditorOption.readOnly)\n\t\t\t&& options.get(EditorOption.dragAndDrop)\n\t\t\t&& !options.get(EditorOption.columnSelection)\n\t\t\t&& !this._mouseState.altKey // we don't support multiple mouse\n\t\t\t&& e.detail < 2 // only single click on a selection can work\n\t\t\t&& !this._isActive // the mouse is not down yet\n\t\t\t&& !this._currentSelection.isEmpty() // we don't drag single cursor\n\t\t\t&& (position.type === MouseTargetType.CONTENT_TEXT) // single click on text\n\t\t\t&& position.position && this._currentSelection.containsPosition(position.position) // single click on a selection\n\t\t) {\n\t\t\tthis._mouseState.isDragAndDrop = true;\n\t\t\tthis._isActive = true;\n\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t(browserEvent?: MouseEvent | KeyboardEvent) => {\n\t\t\t\t\tconst position = this._findMousePosition(this._lastMouseEvent!, false);\n\n\t\t\t\t\tif (dom.isKeyboardEvent(browserEvent)) {\n\t\t\t\t\t\t// cancel\n\t\t\t\t\t\tthis._viewController.emitMouseDropCanceled();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._viewController.emitMouseDrop({\n\t\t\t\t\t\t\tevent: this._lastMouseEvent!,\n\t\t\t\t\t\t\ttarget: (position ? this._createMouseTarget(this._lastMouseEvent!, true) : null) // Ignoring because position is unknown, e.g., Content View Zone\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._stop();\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.isDragAndDrop = false;\n\t\tthis._dispatchMouse(position, e.shiftKey, NavigationCommandRevealType.Minimal);\n\n\t\tif (!this._isActive) {\n\t\t\tthis._isActive = true;\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t() => this._stop()\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _stop(): void {\n\t\tthis._isActive = false;\n\t\tthis._topBottomDragScrolling.stop();\n\t\tthis._leftRightDragScrolling.stop();\n\t}\n\n\tpublic onHeightChanged(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onPointerUp(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): void {\n\t\tthis._currentSelection = e.selections[0];\n\t}\n\n\tprivate _getPositionOutsideEditor(e: EditorMouseEvent): IMouseTarget | null {\n\t\tconst editorContent = e.editorPos;\n\t\tconst model = this._context.viewModel;\n\t\tconst viewLayout = this._context.viewLayout;\n\n\t\tconst mouseColumn = this._getMouseColumn(e);\n\n\t\tif (e.posy < editorContent.y) {\n\t\t\tconst outsideDistance = editorContent.y - e.posy;\n\t\t\tconst verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - outsideDistance, 0);\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'above', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(aboveLineNumber, 1), 'above', outsideDistance);\n\t\t}\n\n\t\tif (e.posy > editorContent.y + editorContent.height) {\n\t\t\tconst outsideDistance = e.posy - editorContent.y - editorContent.height;\n\t\t\tconst verticalOffset = viewLayout.getCurrentScrollTop() + e.relativePos.y;\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'below', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)), 'below', outsideDistance);\n\t\t}\n\n\t\tconst possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + e.relativePos.y);\n\n\t\tconst layoutInfo = this._context.configuration.options.get(EditorOption.layoutInfo);\n\n\t\tconst xLeftBoundary = layoutInfo.contentLeft;\n\t\tif (e.relativePos.x <= xLeftBoundary) {\n\t\t\tconst outsideDistance = xLeftBoundary - e.relativePos.x;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? model.getLineMaxColumn(possibleLineNumber) : 1), 'left', outsideDistance);\n\t\t}\n\n\t\tconst contentRight = (\n\t\t\tlayoutInfo.minimap.minimapLeft === 0\n\t\t\t\t? layoutInfo.width - layoutInfo.verticalScrollbarWidth // Happens when minimap is hidden\n\t\t\t\t: layoutInfo.minimap.minimapLeft\n\t\t);\n\t\tconst xRightBoundary = contentRight;\n\t\tif (e.relativePos.x >= xRightBoundary) {\n\t\t\tconst outsideDistance = e.relativePos.x - xRightBoundary;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? 1 : model.getLineMaxColumn(possibleLineNumber)), 'right', outsideDistance);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate _findMousePosition(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget | null {\n\t\tconst positionOutsideEditor = this._getPositionOutsideEditor(e);\n\t\tif (positionOutsideEditor) {\n\t\t\treturn positionOutsideEditor;\n\t\t}\n\n\t\tconst t = this._createMouseTarget(e, testEventTarget);\n\t\tconst hintedPosition = t.position;\n\t\tif (!hintedPosition) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE) {\n\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(t.detail);\n\t\t\tif (newPosition) {\n\t\t\t\treturn MouseTarget.createViewZone(t.type, t.element, t.mouseColumn, newPosition, t.detail);\n\t\t\t}\n\t\t}\n\n\t\treturn t;\n\t}\n\n\tprivate _helpPositionJumpOverViewZone(viewZoneData: IMouseTargetViewZoneData): Position | null {\n\t\t// Force position on view zones to go above or below depending on where selection started from\n\t\tconst selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);\n\t\tconst positionBefore = viewZoneData.positionBefore;\n\t\tconst positionAfter = viewZoneData.positionAfter;\n\n\t\tif (positionBefore && positionAfter) {\n\t\t\tif (positionBefore.isBefore(selectionStart)) {\n\t\t\t\treturn positionBefore;\n\t\t\t} else {\n\t\t\t\treturn positionAfter;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate _dispatchMouse(position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType): void {\n\t\tif (!position.position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._viewController.dispatchMouse({\n\t\t\tposition: position.position,\n\t\t\tmouseColumn: position.mouseColumn,\n\t\t\tstartedOnLineNumbers: this._mouseState.startedOnLineNumbers,\n\t\t\trevealType,\n\n\t\t\tinSelectionMode: inSelectionMode,\n\t\t\tmouseDownCount: this._mouseState.count,\n\t\t\taltKey: this._mouseState.altKey,\n\t\t\tctrlKey: this._mouseState.ctrlKey,\n\t\t\tmetaKey: this._mouseState.metaKey,\n\t\t\tshiftKey: this._mouseState.shiftKey,\n\n\t\t\tleftButton: this._mouseState.leftButton,\n\t\t\tmiddleButton: this._mouseState.middleButton,\n\n\t\t\tonInjectedText: position.type === MouseTargetType.CONTENT_TEXT && position.detail.injectedText !== null\n\t\t});\n\t}\n}\n\nclass MouseDownState {\n\n\tprivate static readonly CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms\n\n\tprivate _altKey: boolean;\n\tpublic get altKey(): boolean { return this._altKey; }\n\n\tprivate _ctrlKey: boolean;\n\tpublic get ctrlKey(): boolean { return this._ctrlKey; }\n\n\tprivate _metaKey: boolean;\n\tpublic get metaKey(): boolean { return this._metaKey; }\n\n\tprivate _shiftKey: boolean;\n\tpublic get shiftKey(): boolean { return this._shiftKey; }\n\n\tprivate _leftButton: boolean;\n\tpublic get leftButton(): boolean { return this._leftButton; }\n\n\tprivate _middleButton: boolean;\n\tpublic get middleButton(): boolean { return this._middleButton; }\n\n\tprivate _startedOnLineNumbers: boolean;\n\tpublic get startedOnLineNumbers(): boolean { return this._startedOnLineNumbers; }\n\n\tprivate _lastMouseDownPosition: Position | null;\n\tprivate _lastMouseDownPositionEqualCount: number;\n\tprivate _lastMouseDownCount: number;\n\tprivate _lastSetMouseDownCountTime: number;\n\tpublic isDragAndDrop: boolean;\n\n\tconstructor() {\n\t\tthis._altKey = false;\n\t\tthis._ctrlKey = false;\n\t\tthis._metaKey = false;\n\t\tthis._shiftKey = false;\n\t\tthis._leftButton = false;\n\t\tthis._middleButton = false;\n\t\tthis._startedOnLineNumbers = false;\n\t\tthis._lastMouseDownPosition = null;\n\t\tthis._lastMouseDownPositionEqualCount = 0;\n\t\tthis._lastMouseDownCount = 0;\n\t\tthis._lastSetMouseDownCountTime = 0;\n\t\tthis.isDragAndDrop = false;\n\t}\n\n\tpublic get count(): number {\n\t\treturn this._lastMouseDownCount;\n\t}\n\n\tpublic setModifiers(source: EditorMouseEvent) {\n\t\tthis._altKey = source.altKey;\n\t\tthis._ctrlKey = source.ctrlKey;\n\t\tthis._metaKey = source.metaKey;\n\t\tthis._shiftKey = source.shiftKey;\n\t}\n\n\tpublic setStartButtons(source: EditorMouseEvent) {\n\t\tthis._leftButton = source.leftButton;\n\t\tthis._middleButton = source.middleButton;\n\t}\n\n\tpublic setStartedOnLineNumbers(startedOnLineNumbers: boolean): void {\n\t\tthis._startedOnLineNumbers = startedOnLineNumbers;\n\t}\n\n\tpublic trySetCount(setMouseDownCount: number, newMouseDownPosition: Position): void {\n\t\t// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tconst currentTime = (new Date()).getTime();\n\t\tif (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {\n\t\t\tsetMouseDownCount = 1;\n\t\t}\n\t\tthis._lastSetMouseDownCountTime = currentTime;\n\n\t\t// b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tif (setMouseDownCount > this._lastMouseDownCount + 1) {\n\t\t\tsetMouseDownCount = this._lastMouseDownCount + 1;\n\t\t}\n\n\t\t// c. Invalidate multiple clicking if the logical position is different\n\t\tif (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {\n\t\t\tthis._lastMouseDownPositionEqualCount++;\n\t\t} else {\n\t\t\tthis._lastMouseDownPositionEqualCount = 1;\n\t\t}\n\t\tthis._lastMouseDownPosition = newMouseDownPosition;\n\n\t\t// Finally set the lastMouseDownCount\n\t\tthis._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);\n\t}\n\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/mouseH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AAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,WAAW,GAAG,IAAI,CAAC,0BAA0B,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAC;YAChG,iBAAiB,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,0BAA0B,GAAG,WAAW,CAAC;QAE9C,iKAAiK;QACjK,IAAI,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;YACtD,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QAClD,CAAC;QAED,uEAAuE;QACvE,IAAI,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC7F,IAAI,CAAC,gCAAgC,EAAE,CAAC;QACzC,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,gCAAgC,GAAG,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,sBAAsB,GAAG,oBAAoB,CAAC;QAEnD,qCAAqC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAC/F,CAAC","file":"mouseHandler.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../base/browser/dom.js';\nimport { StandardWheelEvent, IMouseWheelEvent } from '../../../base/browser/mouseEvent.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { HitTestContext, MouseTarget, MouseTargetFactory, PointerHandlerLastRenderData } from './mouseTarget.js';\nimport { IMouseTarget, IMouseTargetViewZoneData, MouseTargetType } from '../editorBrowser.js';\nimport { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorPointerMoveMonitor, createEditorPagePosition, createCoordinatesRelativeToEditor } from '../editorDom.js';\nimport { ViewController } from '../view/viewController.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { Position } from '../../common/core/position.js';\nimport { Selection } from '../../common/core/selection.js';\nimport { HorizontalPosition } from '../view/renderingContext.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../common/viewEvents.js';\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { MouseWheelClassifier } from '../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { ViewLinesGpu } from '../viewParts/viewLinesGpu/viewLinesGpu.js';\nimport { TopBottomDragScrolling, LeftRightDragScrolling } from './dragScrolling.js';\nimport { TextDirection } from '../../common/model.js';\nimport { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from '../../../base/browser/ui/mouseCursor/mouseCursor.js';\n\nexport interface IPointerHandlerHelper {\n\tviewDomNode: HTMLElement;\n\tmarginDomNode: HTMLElement;\n\tlinesContentDomNode: HTMLElement;\n\tviewLinesDomNode: HTMLElement;\n\tviewLinesGpu: ViewLinesGpu | undefined;\n\n\tfocusTextArea(): void;\n\tdispatchTextAreaEvent(event: CustomEvent): void;\n\n\t/**\n\t * Get the last rendered information for cursors & textarea.\n\t */\n\tgetLastRenderData(): PointerHandlerLastRenderData;\n\n\t/**\n\t * Render right now\n\t */\n\trenderNow(): void;\n\n\tshouldSuppressMouseDownOnViewZone(viewZoneId: string): boolean;\n\tshouldSuppressMouseDownOnWidget(widgetId: string): boolean;\n\n\t/**\n\t * Decode a position from a rendered dom node\n\t */\n\tgetPositionFromDOMInfo(spanNode: HTMLElement, offset: number): Position | null;\n\n\tvisibleRangeForPosition(lineNumber: number, column: number): HorizontalPosition | null;\n\tgetLineWidth(lineNumber: number): number;\n}\n\nexport class MouseHandler extends ViewEventHandler {\n\n\tprotected _context: ViewContext;\n\tprotected viewController: ViewController;\n\tprotected viewHelper: IPointerHandlerHelper;\n\tprotected mouseTargetFactory: MouseTargetFactory;\n\tprotected readonly _mouseDownOperation: MouseDownOperation;\n\tprivate lastMouseLeaveTime: number;\n\tprivate _height: number;\n\tprivate _mouseLeaveMonitor: IDisposable | null = null;\n\n\tconstructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {\n\t\tsuper();\n\n\t\tthis._context = context;\n\t\tthis.viewController = viewController;\n\t\tthis.viewHelper = viewHelper;\n\t\tthis.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);\n\n\t\tthis._mouseDownOperation = this._register(new MouseDownOperation(\n\t\t\tthis._context,\n\t\t\tthis.viewController,\n\t\t\tthis.viewHelper,\n\t\t\tthis.mouseTargetFactory,\n\t\t\t(e, testEventTarget) => this._createMouseTarget(e, testEventTarget),\n\t\t\t(e) => this._getMouseColumn(e)\n\t\t));\n\n\t\tthis.lastMouseLeaveTime = -1;\n\t\tthis._height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\n\t\tconst mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);\n\n\t\tthis._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));\n\n\t\tthis._register(mouseEvents.onMouseMove(this.viewHelper.viewDomNode, (e) => {\n\t\t\tthis._onMouseMove(e);\n\n\t\t\t// See https://github.com/microsoft/vscode/issues/138789\n\t\t\t// When moving the mouse really quickly, the browser sometimes forgets to\n\t\t\t// send us a `mouseleave` or `mouseout` event. We therefore install here\n\t\t\t// a global `mousemove` listener to manually recover if the mouse goes outside\n\t\t\t// the editor. As soon as the mouse leaves outside of the editor, we\n\t\t\t// remove this listener\n\n\t\t\tif (!this._mouseLeaveMonitor) {\n\t\t\t\tthis._mouseLeaveMonitor = dom.addDisposableListener(this.viewHelper.viewDomNode.ownerDocument, 'mousemove', (e) => {\n\t\t\t\t\tif (!this.viewHelper.viewDomNode.contains(e.target as Node | null)) {\n\t\t\t\t\t\t// went outside the editor!\n\t\t\t\t\t\tthis._onMouseLeave(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n\n\t\tthis._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n\n\t\t// `pointerdown` events can't be used to determine if there's a double click, or triple click\n\t\t// because their `e.detail` is always 0.\n\t\t// We will therefore save the pointer id for the mouse and then reuse it in the `mousedown` event\n\t\t// for `element.setPointerCapture`.\n\t\tlet capturePointerId: number = 0;\n\t\tthis._register(mouseEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => {\n\t\t\tcapturePointerId = pointerId;\n\t\t}));\n\t\t// The `pointerup` listener registered by `GlobalEditorPointerMoveMonitor` does not get invoked 100% of the times.\n\t\t// I speculate that this is because the `pointerup` listener is only registered during the `mousedown` event, and perhaps\n\t\t// the `pointerup` event is already queued for dispatching, which makes it that the new listener doesn't get fired.\n\t\t// See https://github.com/microsoft/vscode/issues/146486 for repro steps.\n\t\t// To compensate for that, we simply register here a `pointerup` listener and just communicate it.\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.POINTER_UP, (e: PointerEvent) => {\n\t\t\tthis._mouseDownOperation.onPointerUp();\n\t\t}));\n\t\tthis._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId)));\n\t\tthis._setupMouseWheelZoomListener();\n\n\t\tthis._context.addEventHandler(this);\n\t}\n\n\tprivate _setupMouseWheelZoomListener(): void {\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\n\t\tlet prevMouseWheelTime = 0;\n\t\tlet gestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\tlet gestureHasZoomModifiers = false;\n\t\tlet gestureAccumulatedDelta = 0;\n\n\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\tthis.viewController.emitMouseWheel(browserEvent);\n\n\t\t\tif (!this._context.configuration.options.get(EditorOption.mouseWheelZoom)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst e = new StandardWheelEvent(browserEvent);\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\n\t\t\tif (classifier.isPhysicalMouseWheel()) {\n\t\t\t\tif (hasMouseWheelZoomModifiers(browserEvent)) {\n\t\t\t\t\tconst zoomLevel: number = EditorZoom.getZoomLevel();\n\t\t\t\t\tconst delta = e.deltaY > 0 ? 1 : -1;\n\t\t\t\t\tEditorZoom.setZoomLevel(zoomLevel + delta);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we consider mousewheel events that occur within 50ms of each other to be part of the same gesture\n\t\t\t\t// we don't want to consider mouse wheel events where ctrl/cmd is pressed during the inertia phase\n\t\t\t\t// we also want to accumulate deltaY values from the same gesture and use that to set the zoom level\n\t\t\t\tif (Date.now() - prevMouseWheelTime > 50) {\n\t\t\t\t\t// reset if more than 50ms have passed\n\t\t\t\t\tgestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\t\t\t\tgestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent);\n\t\t\t\t\tgestureAccumulatedDelta = 0;\n\t\t\t\t}\n\n\t\t\t\tprevMouseWheelTime = Date.now();\n\t\t\t\tgestureAccumulatedDelta += e.deltaY;\n\n\t\t\t\tif (gestureHasZoomModifiers) {\n\t\t\t\t\tEditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));\n\n\t\tfunction hasMouseWheelZoomModifiers(browserEvent: IMouseWheelEvent): boolean {\n\t\t\treturn (\n\t\t\t\tplatform.isMacintosh\n\t\t\t\t\t// on macOS we support cmd + two fingers scroll (`metaKey` set)\n\t\t\t\t\t// and also the two fingers pinch gesture (`ctrKey` set)\n\t\t\t\t\t? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t\t\t: (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._context.removeEventHandler(this);\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t// --- begin event handlers\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\t// layout change\n\t\t\tconst height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\t\t\tif (this._height !== height) {\n\t\t\t\tthis._height = height;\n\t\t\t\tthis._mouseDownOperation.onHeightChanged();\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tpublic override onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {\n\t\tthis._mouseDownOperation.onCursorStateChanged(e);\n\t\treturn false;\n\t}\n\tpublic override onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean {\n\t\treturn false;\n\t}\n\t// --- end event handlers\n\n\tpublic getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null {\n\t\tconst clientPos = new ClientCoordinates(clientX, clientY);\n\t\tconst pos = clientPos.toPageCoordinates(dom.getWindow(this.viewHelper.viewDomNode));\n\t\tconst editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);\n\n\t\tif (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst relativePos = createCoordinatesRelativeToEditor(this.viewHelper.viewDomNode, editorPos, pos);\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t}\n\n\tprotected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget {\n\t\tlet target: HTMLElement | null = e.target;\n\t\tif (!this.viewHelper.viewDomNode.contains(target)) {\n\t\t\tconst shadowRoot = dom.getShadowRoot(this.viewHelper.viewDomNode);\n\t\t\tif (shadowRoot) {\n\t\t\t\tconst potentialTarget = shadowRoot.elementsFromPoint(e.posx, e.posy).find(\n\t\t\t\t\t(el: Element) => this.viewHelper.viewDomNode.contains(el)\n\t\t\t\t) ?? null;\n\t\t\t\ttarget = potentialTarget as HTMLElement;\n\t\t\t}\n\t\t}\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, e.relativePos, testEventTarget ? target : null);\n\t}\n\n\tprivate _getMouseColumn(e: EditorMouseEvent): number {\n\t\treturn this.mouseTargetFactory.getMouseColumn(e.relativePos);\n\t}\n\n\tprotected _onContextMenu(e: EditorMouseEvent, testEventTarget: boolean): void {\n\t\tthis.viewController.emitContextMenu({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, testEventTarget)\n\t\t});\n\t}\n\n\tprotected _onMouseMove(e: EditorMouseEvent): void {\n\t\tconst targetIsWidget = this.mouseTargetFactory.mouseTargetIsWidget(e);\n\t\tif (!targetIsWidget) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tif (this._mouseDownOperation.isActive()) {\n\t\t\t// In selection/drag operation\n\t\t\treturn;\n\t\t}\n\t\tconst actualMouseMoveTime = e.timestamp;\n\t\tif (actualMouseMoveTime < this.lastMouseLeaveTime) {\n\t\t\t// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.\n\t\t\treturn;\n\t\t}\n\n\t\tconst target = this._createMouseTarget(e, true);\n\t\t// Show the text cursor where a click in the margin places the cursor (see `MouseTargetFactory._hitTestMargin`)\n\t\tconst options = this._context.configuration.options;\n\t\tconst isContentInMargin = target.type === MouseTargetType.CONTENT_EMPTY && e.relativePos.x < options.get(EditorOption.layoutInfo).contentLeft;\n\t\tthis.viewHelper.marginDomNode.classList.toggle(MOUSE_CURSOR_TEXT_CSS_CLASS_NAME, isContentInMargin && options.get(EditorOption.mouseStyle) === 'text');\n\t\tthis.viewController.emitMouseMove({\n\t\t\tevent: e,\n\t\t\ttarget\n\t\t});\n\t}\n\n\tprotected _onMouseLeave(e: EditorMouseEvent): void {\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tthis.viewHelper.marginDomNode.classList.remove(MOUSE_CURSOR_TEXT_CSS_CLASS_NAME);\n\t\tthis.lastMouseLeaveTime = (new Date()).getTime();\n\t\tthis.viewController.emitMouseLeave({\n\t\t\tevent: e,\n\t\t\ttarget: null\n\t\t});\n\t}\n\n\tprotected _onMouseUp(e: EditorMouseEvent): void {\n\t\tthis.viewController.emitMouseUp({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, true)\n\t\t});\n\t}\n\n\tprotected _onMouseDown(e: EditorMouseEvent, pointerId: number): void {\n\t\tconst t = this._createMouseTarget(e, true);\n\n\t\tconst targetIsContent = (t.type === MouseTargetType.CONTENT_TEXT || t.type === MouseTargetType.CONTENT_EMPTY);\n\t\tconst targetIsGutter = (t.type === MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === MouseTargetType.GUTTER_LINE_NUMBERS || t.type === MouseTargetType.GUTTER_LINE_DECORATIONS);\n\t\tconst targetIsLineNumbers = (t.type === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tconst selectOnLineNumbers = this._context.configuration.options.get(EditorOption.selectOnLineNumbers);\n\t\tconst targetIsViewZone = (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE);\n\t\tconst targetIsWidget = (t.type === MouseTargetType.CONTENT_WIDGET);\n\n\t\tlet shouldHandle = e.leftButton || e.middleButton;\n\t\tif (platform.isMacintosh && e.leftButton && e.ctrlKey) {\n\t\t\tshouldHandle = false;\n\t\t}\n\n\t\tconst focus = () => {\n\t\t\te.preventDefault();\n\t\t\tthis.viewHelper.focusTextArea();\n\t\t};\n\n\t\tif (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {\n\t\t\tfocus();\n\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\n\t\t} else if (targetIsGutter) {\n\t\t\t// Do not steal focus\n\t\t\te.preventDefault();\n\t\t} else if (targetIsViewZone) {\n\t\t\tconst viewZoneData = t.detail;\n\t\t\tif (shouldHandle && this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {\n\t\t\t\tfocus();\n\t\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t} else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {\n\t\t\tfocus();\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tthis.viewController.emitMouseDown({\n\t\t\tevent: e,\n\t\t\ttarget: t\n\t\t});\n\t}\n}\n\nclass MouseDownOperation extends Disposable {\n\n\tprivate readonly _createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget;\n\tprivate readonly _getMouseColumn: (e: EditorMouseEvent) => number;\n\n\tprivate readonly _mouseMoveMonitor: GlobalEditorPointerMoveMonitor;\n\tprivate readonly _topBottomDragScrolling: TopBottomDragScrolling;\n\tprivate readonly _leftRightDragScrolling: LeftRightDragScrolling;\n\tprivate readonly _mouseState: MouseDownState;\n\n\tprivate _currentSelection: Selection;\n\tprivate _isActive: boolean;\n\tprivate _lastMouseEvent: EditorMouseEvent | null;\n\n\tconstructor(\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\tprivate readonly _viewHelper: IPointerHandlerHelper,\n\t\tprivate readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tcreateMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget,\n\t\tgetMouseColumn: (e: EditorMouseEvent) => number\n\t) {\n\t\tsuper();\n\t\tthis._createMouseTarget = createMouseTarget;\n\t\tthis._getMouseColumn = getMouseColumn;\n\n\t\tthis._mouseMoveMonitor = this._register(new GlobalEditorPointerMoveMonitor(this._viewHelper.viewDomNode));\n\t\tthis._topBottomDragScrolling = this._register(new TopBottomDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._leftRightDragScrolling = this._register(new LeftRightDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._mouseState = new MouseDownState();\n\n\t\tthis._currentSelection = new Selection(1, 1, 1, 1);\n\t\tthis._isActive = false;\n\t\tthis._lastMouseEvent = null;\n\t}\n\n\tpublic isActive(): boolean {\n\t\treturn this._isActive;\n\t}\n\n\tprivate _onMouseDownThenMove(e: EditorMouseEvent): void {\n\t\tthis._lastMouseEvent = e;\n\t\tthis._mouseState.setModifiers(e);\n\n\t\tconst position = this._findMousePosition(e, false);\n\t\tif (!position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._mouseState.isDragAndDrop) {\n\t\t\tthis._viewController.emitMouseDrag({\n\t\t\t\tevent: e,\n\t\t\t\ttarget: position\n\t\t\t});\n\t\t} else {\n\t\t\tif (position.type === MouseTargetType.OUTSIDE_EDITOR) {\n\t\t\t\tif (position.outsidePosition === 'above' || position.outsidePosition === 'below') {\n\t\t\t\t\tthis._topBottomDragScrolling.start(position, e);\n\t\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\t} else {\n\t\t\t\t\tthis._leftRightDragScrolling.start(position, e);\n\t\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\tthis._dispatchMouse(position, true, NavigationCommandRevealType.Minimal);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic start(targetType: MouseTargetType, e: EditorMouseEvent, pointerId: number): void {\n\t\tthis._lastMouseEvent = e;\n\n\t\tthis._mouseState.setStartedOnLineNumbers(targetType === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tthis._mouseState.setStartButtons(e);\n\t\tthis._mouseState.setModifiers(e);\n\t\tconst position = this._findMousePosition(e, true);\n\t\tif (!position || !position.position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.trySetCount(e.detail, position.position);\n\n\t\t// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.\n\t\te.detail = this._mouseState.count;\n\n\t\tconst options = this._context.configuration.options;\n\n\t\tif (!options.get(EditorOption.readOnly)\n\t\t\t&& options.get(EditorOption.dragAndDrop)\n\t\t\t&& !options.get(EditorOption.columnSelection)\n\t\t\t&& !this._mouseState.altKey // we don't support multiple mouse\n\t\t\t&& e.detail < 2 // only single click on a selection can work\n\t\t\t&& !this._isActive // the mouse is not down yet\n\t\t\t&& !this._currentSelection.isEmpty() // we don't drag single cursor\n\t\t\t&& (position.type === MouseTargetType.CONTENT_TEXT) // single click on text\n\t\t\t&& position.position && this._currentSelection.containsPosition(position.position) // single click on a selection\n\t\t) {\n\t\t\tthis._mouseState.isDragAndDrop = true;\n\t\t\tthis._isActive = true;\n\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t(browserEvent?: MouseEvent | KeyboardEvent) => {\n\t\t\t\t\tconst position = this._findMousePosition(this._lastMouseEvent!, false);\n\n\t\t\t\t\tif (dom.isKeyboardEvent(browserEvent)) {\n\t\t\t\t\t\t// cancel\n\t\t\t\t\t\tthis._viewController.emitMouseDropCanceled();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._viewController.emitMouseDrop({\n\t\t\t\t\t\t\tevent: this._lastMouseEvent!,\n\t\t\t\t\t\t\ttarget: (position ? this._createMouseTarget(this._lastMouseEvent!, true) : null) // Ignoring because position is unknown, e.g., Content View Zone\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._stop();\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.isDragAndDrop = false;\n\t\tthis._dispatchMouse(position, e.shiftKey, NavigationCommandRevealType.Minimal);\n\n\t\tif (!this._isActive) {\n\t\t\tthis._isActive = true;\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t() => this._stop()\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _stop(): void {\n\t\tthis._isActive = false;\n\t\tthis._topBottomDragScrolling.stop();\n\t\tthis._leftRightDragScrolling.stop();\n\t}\n\n\tpublic onHeightChanged(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onPointerUp(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): void {\n\t\tthis._currentSelection = e.selections[0];\n\t}\n\n\tprivate _getPositionOutsideEditor(e: EditorMouseEvent): IMouseTarget | null {\n\t\tconst editorContent = e.editorPos;\n\t\tconst model = this._context.viewModel;\n\t\tconst viewLayout = this._context.viewLayout;\n\n\t\tconst mouseColumn = this._getMouseColumn(e);\n\n\t\tif (e.posy < editorContent.y) {\n\t\t\tconst outsideDistance = editorContent.y - e.posy;\n\t\t\tconst verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - outsideDistance, 0);\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'above', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(aboveLineNumber, 1), 'above', outsideDistance);\n\t\t}\n\n\t\tif (e.posy > editorContent.y + editorContent.height) {\n\t\t\tconst outsideDistance = e.posy - editorContent.y - editorContent.height;\n\t\t\tconst verticalOffset = viewLayout.getCurrentScrollTop() + e.relativePos.y;\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'below', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)), 'below', outsideDistance);\n\t\t}\n\n\t\tconst possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + e.relativePos.y);\n\n\t\tconst layoutInfo = this._context.configuration.options.get(EditorOption.layoutInfo);\n\n\t\tconst xLeftBoundary = layoutInfo.contentLeft;\n\t\tif (e.relativePos.x <= xLeftBoundary) {\n\t\t\tconst outsideDistance = xLeftBoundary - e.relativePos.x;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? model.getLineMaxColumn(possibleLineNumber) : 1), 'left', outsideDistance);\n\t\t}\n\n\t\tconst contentRight = (\n\t\t\tlayoutInfo.minimap.minimapLeft === 0\n\t\t\t\t? layoutInfo.width - layoutInfo.verticalScrollbarWidth // Happens when minimap is hidden\n\t\t\t\t: layoutInfo.minimap.minimapLeft\n\t\t);\n\t\tconst xRightBoundary = contentRight;\n\t\tif (e.relativePos.x >= xRightBoundary) {\n\t\t\tconst outsideDistance = e.relativePos.x - xRightBoundary;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? 1 : model.getLineMaxColumn(possibleLineNumber)), 'right', outsideDistance);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate _findMousePosition(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget | null {\n\t\tconst positionOutsideEditor = this._getPositionOutsideEditor(e);\n\t\tif (positionOutsideEditor) {\n\t\t\treturn positionOutsideEditor;\n\t\t}\n\n\t\tconst t = this._createMouseTarget(e, testEventTarget);\n\t\tconst hintedPosition = t.position;\n\t\tif (!hintedPosition) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE) {\n\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(t.detail);\n\t\t\tif (newPosition) {\n\t\t\t\treturn MouseTarget.createViewZone(t.type, t.element, t.mouseColumn, newPosition, t.detail);\n\t\t\t}\n\t\t}\n\n\t\treturn t;\n\t}\n\n\tprivate _helpPositionJumpOverViewZone(viewZoneData: IMouseTargetViewZoneData): Position | null {\n\t\t// Force position on view zones to go above or below depending on where selection started from\n\t\tconst selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);\n\t\tconst positionBefore = viewZoneData.positionBefore;\n\t\tconst positionAfter = viewZoneData.positionAfter;\n\n\t\tif (positionBefore && positionAfter) {\n\t\t\tif (positionBefore.isBefore(selectionStart)) {\n\t\t\t\treturn positionBefore;\n\t\t\t} else {\n\t\t\t\treturn positionAfter;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate _dispatchMouse(position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType): void {\n\t\tif (!position.position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._viewController.dispatchMouse({\n\t\t\tposition: position.position,\n\t\t\tmouseColumn: position.mouseColumn,\n\t\t\tstartedOnLineNumbers: this._mouseState.startedOnLineNumbers,\n\t\t\trevealType,\n\n\t\t\tinSelectionMode: inSelectionMode,\n\t\t\tmouseDownCount: this._mouseState.count,\n\t\t\taltKey: this._mouseState.altKey,\n\t\t\tctrlKey: this._mouseState.ctrlKey,\n\t\t\tmetaKey: this._mouseState.metaKey,\n\t\t\tshiftKey: this._mouseState.shiftKey,\n\n\t\t\tleftButton: this._mouseState.leftButton,\n\t\t\tmiddleButton: this._mouseState.middleButton,\n\n\t\t\tonInjectedText: position.type === MouseTargetType.CONTENT_TEXT && position.detail.injectedText !== null\n\t\t});\n\t}\n}\n\nclass MouseDownState {\n\n\tprivate static readonly CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms\n\n\tprivate _altKey: boolean;\n\tpublic get altKey(): boolean { return this._altKey; }\n\n\tprivate _ctrlKey: boolean;\n\tpublic get ctrlKey(): boolean { return this._ctrlKey; }\n\n\tprivate _metaKey: boolean;\n\tpublic get metaKey(): boolean { return this._metaKey; }\n\n\tprivate _shiftKey: boolean;\n\tpublic get shiftKey(): boolean { return this._shiftKey; }\n\n\tprivate _leftButton: boolean;\n\tpublic get leftButton(): boolean { return this._leftButton; }\n\n\tprivate _middleButton: boolean;\n\tpublic get middleButton(): boolean { return this._middleButton; }\n\n\tprivate _startedOnLineNumbers: boolean;\n\tpublic get startedOnLineNumbers(): boolean { return this._startedOnLineNumbers; }\n\n\tprivate _lastMouseDownPosition: Position | null;\n\tprivate _lastMouseDownPositionEqualCount: number;\n\tprivate _lastMouseDownCount: number;\n\tprivate _lastSetMouseDownCountTime: number;\n\tpublic isDragAndDrop: boolean;\n\n\tconstructor() {\n\t\tthis._altKey = false;\n\t\tthis._ctrlKey = false;\n\t\tthis._metaKey = false;\n\t\tthis._shiftKey = false;\n\t\tthis._leftButton = false;\n\t\tthis._middleButton = false;\n\t\tthis._startedOnLineNumbers = false;\n\t\tthis._lastMouseDownPosition = null;\n\t\tthis._lastMouseDownPositionEqualCount = 0;\n\t\tthis._lastMouseDownCount = 0;\n\t\tthis._lastSetMouseDownCountTime = 0;\n\t\tthis.isDragAndDrop = false;\n\t}\n\n\tpublic get count(): number {\n\t\treturn this._lastMouseDownCount;\n\t}\n\n\tpublic setModifiers(source: EditorMouseEvent) {\n\t\tthis._altKey = source.altKey;\n\t\tthis._ctrlKey = source.ctrlKey;\n\t\tthis._metaKey = source.metaKey;\n\t\tthis._shiftKey = source.shiftKey;\n\t}\n\n\tpublic setStartButtons(source: EditorMouseEvent) {\n\t\tthis._leftButton = source.leftButton;\n\t\tthis._middleButton = source.middleButton;\n\t}\n\n\tpublic setStartedOnLineNumbers(startedOnLineNumbers: boolean): void {\n\t\tthis._startedOnLineNumbers = startedOnLineNumbers;\n\t}\n\n\tpublic trySetCount(setMouseDownCount: number, newMouseDownPosition: Position): void {\n\t\t// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tconst currentTime = (new Date()).getTime();\n\t\tif (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {\n\t\t\tsetMouseDownCount = 1;\n\t\t}\n\t\tthis._lastSetMouseDownCountTime = currentTime;\n\n\t\t// b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tif (setMouseDownCount > this._lastMouseDownCount + 1) {\n\t\t\tsetMouseDownCount = this._lastMouseDownCount + 1;\n\t\t}\n\n\t\t// c. Invalidate multiple clicking if the logical position is different\n\t\tif (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {\n\t\t\tthis._lastMouseDownPositionEqualCount++;\n\t\t} else {\n\t\t\tthis._lastMouseDownPositionEqualCount = 1;\n\t\t}\n\t\tthis._lastMouseDownPosition = newMouseDownPosition;\n\n\t\t// Finally set the lastMouseDownCount\n\t\tthis._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../base/browser/dom.js';\nimport { StandardWheelEvent, IMouseWheelEvent } from '../../../base/browser/mouseEvent.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { HitTestContext, MouseTarget, MouseTargetFactory, PointerHandlerLastRenderData } from './mouseTarget.js';\nimport { IMouseTarget, IMouseTargetViewZoneData, MouseTargetType } from '../editorBrowser.js';\nimport { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorPointerMoveMonitor, createEditorPagePosition, createCoordinatesRelativeToEditor } from '../editorDom.js';\nimport { ViewController } from '../view/viewController.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { Position } from '../../common/core/position.js';\nimport { Selection } from '../../common/core/selection.js';\nimport { HorizontalPosition } from '../view/renderingContext.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../common/viewEvents.js';\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { MouseWheelClassifier } from '../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { ViewLinesGpu } from '../viewParts/viewLinesGpu/viewLinesGpu.js';\nimport { TopBottomDragScrolling, LeftRightDragScrolling } from './dragScrolling.js';\nimport { TextDirection } from '../../common/model.js';\nimport { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from '../../../base/browser/ui/mouseCursor/mouseCursor.js';\n\nexport interface IPointerHandlerHelper {\n\tviewDomNode: HTMLElement;\n\tmarginDomNode: HTMLElement;\n\tlinesContentDomNode: HTMLElement;\n\tviewLinesDomNode: HTMLElement;\n\tviewLinesGpu: ViewLinesGpu | undefined;\n\n\tfocusTextArea(): void;\n\tdispatchTextAreaEvent(event: CustomEvent): void;\n\n\t/**\n\t * Get the last rendered information for cursors & textarea.\n\t */\n\tgetLastRenderData(): PointerHandlerLastRenderData;\n\n\t/**\n\t * Render right now\n\t */\n\trenderNow(): void;\n\n\tshouldSuppressMouseDownOnViewZone(viewZoneId: string): boolean;\n\tshouldSuppressMouseDownOnWidget(widgetId: string): boolean;\n\n\t/**\n\t * Decode a position from a rendered dom node\n\t */\n\tgetPositionFromDOMInfo(spanNode: HTMLElement, offset: number): Position | null;\n\n\tvisibleRangeForPosition(lineNumber: number, column: number): HorizontalPosition | null;\n\tgetLineWidth(lineNumber: number): number;\n}\n\nexport class MouseHandler extends ViewEventHandler {\n\n\tprotected _context: ViewContext;\n\tprotected viewController: ViewController;\n\tprotected viewHelper: IPointerHandlerHelper;\n\tprotected mouseTargetFactory: MouseTargetFactory;\n\tprotected readonly _mouseDownOperation: MouseDownOperation;\n\tprivate lastMouseLeaveTime: number;\n\tprivate _height: number;\n\tprivate _mouseLeaveMonitor: IDisposable | null = null;\n\n\tconstructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {\n\t\tsuper();\n\n\t\tthis._context = context;\n\t\tthis.viewController = viewController;\n\t\tthis.viewHelper = viewHelper;\n\t\tthis.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);\n\n\t\tthis._mouseDownOperation = this._register(new MouseDownOperation(\n\t\t\tthis._context,\n\t\t\tthis.viewController,\n\t\t\tthis.viewHelper,\n\t\t\tthis.mouseTargetFactory,\n\t\t\t(e, testEventTarget) => this._createMouseTarget(e, testEventTarget),\n\t\t\t(e) => this._getMouseColumn(e)\n\t\t));\n\n\t\tthis.lastMouseLeaveTime = -1;\n\t\tthis._height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\n\t\tconst mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);\n\n\t\tthis._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));\n\n\t\tthis._register(mouseEvents.onMouseMove(this.viewHelper.viewDomNode, (e) => {\n\t\t\tthis._onMouseMove(e);\n\n\t\t\t// See https://github.com/microsoft/vscode/issues/138789\n\t\t\t// When moving the mouse really quickly, the browser sometimes forgets to\n\t\t\t// send us a `mouseleave` or `mouseout` event. We therefore install here\n\t\t\t// a global `mousemove` listener to manually recover if the mouse goes outside\n\t\t\t// the editor. As soon as the mouse leaves outside of the editor, we\n\t\t\t// remove this listener\n\n\t\t\tif (!this._mouseLeaveMonitor) {\n\t\t\t\tthis._mouseLeaveMonitor = dom.addDisposableListener(this.viewHelper.viewDomNode.ownerDocument, 'mousemove', (e) => {\n\t\t\t\t\tif (!this.viewHelper.viewDomNode.contains(e.target as Node | null)) {\n\t\t\t\t\t\t// went outside the editor!\n\t\t\t\t\t\tthis._onMouseLeave(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n\n\t\tthis._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n\n\t\t// `pointerdown` events can't be used to determine if there's a double click, or triple click\n\t\t// because their `e.detail` is always 0.\n\t\t// We will therefore save the pointer id for the mouse and then reuse it in the `mousedown` event\n\t\t// for `element.setPointerCapture`.\n\t\tlet capturePointerId: number = 0;\n\t\tthis._register(mouseEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => {\n\t\t\tcapturePointerId = pointerId;\n\t\t}));\n\t\t// The `pointerup` listener registered by `GlobalEditorPointerMoveMonitor` does not get invoked 100% of the times.\n\t\t// I speculate that this is because the `pointerup` listener is only registered during the `mousedown` event, and perhaps\n\t\t// the `pointerup` event is already queued for dispatching, which makes it that the new listener doesn't get fired.\n\t\t// See https://github.com/microsoft/vscode/issues/146486 for repro steps.\n\t\t// To compensate for that, we simply register here a `pointerup` listener and just communicate it.\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.POINTER_UP, (e: PointerEvent) => {\n\t\t\tthis._mouseDownOperation.onPointerUp();\n\t\t}));\n\t\tthis._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId)));\n\t\tthis._setupMouseWheelZoomListener();\n\n\t\tthis._context.addEventHandler(this);\n\t}\n\n\tprivate _setupMouseWheelZoomListener(): void {\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\n\t\tlet prevMouseWheelTime = 0;\n\t\tlet gestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\tlet gestureHasZoomModifiers = false;\n\t\tlet gestureAccumulatedDelta = 0;\n\n\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\tthis.viewController.emitMouseWheel(browserEvent);\n\n\t\t\tif (!this._context.configuration.options.get(EditorOption.mouseWheelZoom)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst e = new StandardWheelEvent(browserEvent);\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\n\t\t\tif (classifier.isPhysicalMouseWheel()) {\n\t\t\t\tif (hasMouseWheelZoomModifiers(browserEvent)) {\n\t\t\t\t\tconst zoomLevel: number = EditorZoom.getZoomLevel();\n\t\t\t\t\tconst delta = e.deltaY > 0 ? 1 : -1;\n\t\t\t\t\tEditorZoom.setZoomLevel(zoomLevel + delta);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we consider mousewheel events that occur within 50ms of each other to be part of the same gesture\n\t\t\t\t// we don't want to consider mouse wheel events where ctrl/cmd is pressed during the inertia phase\n\t\t\t\t// we also want to accumulate deltaY values from the same gesture and use that to set the zoom level\n\t\t\t\tif (Date.now() - prevMouseWheelTime > 50) {\n\t\t\t\t\t// reset if more than 50ms have passed\n\t\t\t\t\tgestureStartZoomLevel = EditorZoom.getZoomLevel();\n\t\t\t\t\tgestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent);\n\t\t\t\t\tgestureAccumulatedDelta = 0;\n\t\t\t\t}\n\n\t\t\t\tprevMouseWheelTime = Date.now();\n\t\t\t\tgestureAccumulatedDelta += e.deltaY;\n\n\t\t\t\tif (gestureHasZoomModifiers) {\n\t\t\t\t\tEditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));\n\n\t\tfunction hasMouseWheelZoomModifiers(browserEvent: IMouseWheelEvent): boolean {\n\t\t\treturn (\n\t\t\t\tplatform.isMacintosh\n\t\t\t\t\t// on macOS we support cmd + two fingers scroll (`metaKey` set)\n\t\t\t\t\t// and also the two fingers pinch gesture (`ctrKey` set)\n\t\t\t\t\t? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t\t\t: (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._context.removeEventHandler(this);\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t// --- begin event handlers\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\t// layout change\n\t\t\tconst height = this._context.configuration.options.get(EditorOption.layoutInfo).height;\n\t\t\tif (this._height !== height) {\n\t\t\t\tthis._height = height;\n\t\t\t\tthis._mouseDownOperation.onHeightChanged();\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tpublic override onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {\n\t\tthis._mouseDownOperation.onCursorStateChanged(e);\n\t\treturn false;\n\t}\n\tpublic override onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean {\n\t\treturn false;\n\t}\n\t// --- end event handlers\n\n\tpublic getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null {\n\t\tconst clientPos = new ClientCoordinates(clientX, clientY);\n\t\tconst pos = clientPos.toPageCoordinates(dom.getWindow(this.viewHelper.viewDomNode));\n\t\tconst editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);\n\n\t\tif (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst relativePos = createCoordinatesRelativeToEditor(this.viewHelper.viewDomNode, editorPos, pos);\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t}\n\n\tprotected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget {\n\t\tlet target: HTMLElement | null = e.target;\n\t\tif (!this.viewHelper.viewDomNode.contains(target)) {\n\t\t\tconst shadowRoot = dom.getShadowRoot(this.viewHelper.viewDomNode);\n\t\t\tif (shadowRoot) {\n\t\t\t\tconst potentialTarget = shadowRoot.elementsFromPoint(e.posx, e.posy).find(\n\t\t\t\t\t(el: Element) => this.viewHelper.viewDomNode.contains(el)\n\t\t\t\t) ?? null;\n\t\t\t\ttarget = potentialTarget as HTMLElement;\n\t\t\t}\n\t\t}\n\t\treturn this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, e.relativePos, testEventTarget ? target : null);\n\t}\n\n\tprivate _getMouseColumn(e: EditorMouseEvent): number {\n\t\treturn this.mouseTargetFactory.getMouseColumn(e.relativePos);\n\t}\n\n\tprotected _onContextMenu(e: EditorMouseEvent, testEventTarget: boolean): void {\n\t\tthis.viewController.emitContextMenu({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, testEventTarget)\n\t\t});\n\t}\n\n\tprotected _onMouseMove(e: EditorMouseEvent): void {\n\t\tconst targetIsWidget = this.mouseTargetFactory.mouseTargetIsWidget(e);\n\t\tif (!targetIsWidget) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tif (this._mouseDownOperation.isActive()) {\n\t\t\t// In selection/drag operation\n\t\t\treturn;\n\t\t}\n\t\tconst actualMouseMoveTime = e.timestamp;\n\t\tif (actualMouseMoveTime < this.lastMouseLeaveTime) {\n\t\t\t// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.\n\t\t\treturn;\n\t\t}\n\n\t\tconst target = this._createMouseTarget(e, true);\n\t\t// Show the text cursor where a click in the margin places the cursor (see `MouseTargetFactory._hitTestMargin`)\n\t\tconst options = this._context.configuration.options;\n\t\tconst isContentInMargin = target.type === MouseTargetType.CONTENT_EMPTY && e.relativePos.x < options.get(EditorOption.layoutInfo).contentLeft;\n\t\tthis.viewHelper.marginDomNode.classList.toggle(MOUSE_CURSOR_TEXT_CSS_CLASS_NAME, isContentInMargin && options.get(EditorOption.mouseStyle) === 'text');\n\t\tthis.viewController.emitMouseMove({\n\t\t\tevent: e,\n\t\t\ttarget\n\t\t});\n\t}\n\n\tprotected _onMouseLeave(e: EditorMouseEvent): void {\n\t\tif (this._mouseLeaveMonitor) {\n\t\t\tthis._mouseLeaveMonitor.dispose();\n\t\t\tthis._mouseLeaveMonitor = null;\n\t\t}\n\t\tthis.viewHelper.marginDomNode.classList.remove(MOUSE_CURSOR_TEXT_CSS_CLASS_NAME);\n\t\tthis.lastMouseLeaveTime = (new Date()).getTime();\n\t\tthis.viewController.emitMouseLeave({\n\t\t\tevent: e,\n\t\t\ttarget: null\n\t\t});\n\t}\n\n\tprotected _onMouseUp(e: EditorMouseEvent): void {\n\t\tthis.viewController.emitMouseUp({\n\t\t\tevent: e,\n\t\t\ttarget: this._createMouseTarget(e, true)\n\t\t});\n\t}\n\n\tprotected _onMouseDown(e: EditorMouseEvent, pointerId: number): void {\n\t\tconst t = this._createMouseTarget(e, true);\n\n\t\tconst targetIsContent = (t.type === MouseTargetType.CONTENT_TEXT || t.type === MouseTargetType.CONTENT_EMPTY);\n\t\tconst targetIsGutter = (t.type === MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === MouseTargetType.GUTTER_LINE_NUMBERS || t.type === MouseTargetType.GUTTER_LINE_DECORATIONS);\n\t\tconst targetIsLineNumbers = (t.type === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tconst selectOnLineNumbers = this._context.configuration.options.get(EditorOption.selectOnLineNumbers);\n\t\tconst targetIsViewZone = (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE);\n\t\tconst targetIsWidget = (t.type === MouseTargetType.CONTENT_WIDGET);\n\n\t\tlet shouldHandle = e.leftButton || e.middleButton;\n\t\tif (platform.isMacintosh && e.leftButton && e.ctrlKey) {\n\t\t\tshouldHandle = false;\n\t\t}\n\n\t\tconst focus = () => {\n\t\t\te.preventDefault();\n\t\t\tthis.viewHelper.focusTextArea();\n\t\t};\n\n\t\tif (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {\n\t\t\tfocus();\n\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\n\t\t} else if (targetIsGutter) {\n\t\t\t// Do not steal focus\n\t\t\te.preventDefault();\n\t\t} else if (targetIsViewZone) {\n\t\t\tconst viewZoneData = t.detail;\n\t\t\tif (shouldHandle && this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {\n\t\t\t\tfocus();\n\t\t\t\tthis._mouseDownOperation.start(t.type, e, pointerId);\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t} else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {\n\t\t\tfocus();\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tthis.viewController.emitMouseDown({\n\t\t\tevent: e,\n\t\t\ttarget: t\n\t\t});\n\t}\n}\n\nclass MouseDownOperation extends Disposable {\n\n\tprivate readonly _createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget;\n\tprivate readonly _getMouseColumn: (e: EditorMouseEvent) => number;\n\n\tprivate readonly _mouseMoveMonitor: GlobalEditorPointerMoveMonitor;\n\tprivate readonly _topBottomDragScrolling: TopBottomDragScrolling;\n\tprivate readonly _leftRightDragScrolling: LeftRightDragScrolling;\n\tprivate readonly _mouseState: MouseDownState;\n\n\tprivate _currentSelection: Selection;\n\tprivate _isActive: boolean;\n\tprivate _lastMouseEvent: EditorMouseEvent | null;\n\n\tconstructor(\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\tprivate readonly _viewHelper: IPointerHandlerHelper,\n\t\tprivate readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tcreateMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget,\n\t\tgetMouseColumn: (e: EditorMouseEvent) => number\n\t) {\n\t\tsuper();\n\t\tthis._createMouseTarget = createMouseTarget;\n\t\tthis._getMouseColumn = getMouseColumn;\n\n\t\tthis._mouseMoveMonitor = this._register(new GlobalEditorPointerMoveMonitor(this._viewHelper.viewDomNode));\n\t\tthis._topBottomDragScrolling = this._register(new TopBottomDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._leftRightDragScrolling = this._register(new LeftRightDragScrolling(\n\t\t\tthis._context,\n\t\t\tthis._viewHelper,\n\t\t\tthis._mouseTargetFactory,\n\t\t\t(position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)\n\t\t));\n\t\tthis._mouseState = new MouseDownState();\n\n\t\tthis._currentSelection = new Selection(1, 1, 1, 1);\n\t\tthis._isActive = false;\n\t\tthis._lastMouseEvent = null;\n\t}\n\n\tpublic isActive(): boolean {\n\t\treturn this._isActive;\n\t}\n\n\tprivate _onMouseDownThenMove(e: EditorMouseEvent): void {\n\t\tthis._lastMouseEvent = e;\n\t\tthis._mouseState.setModifiers(e);\n\n\t\tconst position = this._findMousePosition(e, false);\n\t\tif (!position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._mouseState.isDragAndDrop) {\n\t\t\tthis._viewController.emitMouseDrag({\n\t\t\t\tevent: e,\n\t\t\t\ttarget: position\n\t\t\t});\n\t\t} else {\n\t\t\tif (position.type === MouseTargetType.OUTSIDE_EDITOR) {\n\t\t\t\tif (position.outsidePosition === 'above' || position.outsidePosition === 'below') {\n\t\t\t\t\tthis._topBottomDragScrolling.start(position, e);\n\t\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\t} else {\n\t\t\t\t\tthis._leftRightDragScrolling.start(position, e);\n\t\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._topBottomDragScrolling.stop();\n\t\t\t\tthis._leftRightDragScrolling.stop();\n\t\t\t\tthis._dispatchMouse(position, true, NavigationCommandRevealType.Minimal);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic start(targetType: MouseTargetType, e: EditorMouseEvent, pointerId: number): void {\n\t\tthis._lastMouseEvent = e;\n\n\t\tthis._mouseState.setStartedOnLineNumbers(targetType === MouseTargetType.GUTTER_LINE_NUMBERS);\n\t\tthis._mouseState.setStartButtons(e);\n\t\tthis._mouseState.setModifiers(e);\n\t\tconst position = this._findMousePosition(e, true);\n\t\tif (!position || !position.position) {\n\t\t\t// Ignoring because position is unknown\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.trySetCount(e.detail, position.position);\n\n\t\t// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.\n\t\te.detail = this._mouseState.count;\n\n\t\tconst options = this._context.configuration.options;\n\n\t\tif (!options.get(EditorOption.readOnly)\n\t\t\t&& options.get(EditorOption.dragAndDrop)\n\t\t\t&& !options.get(EditorOption.columnSelection)\n\t\t\t&& !this._mouseState.altKey // we don't support multiple mouse\n\t\t\t&& e.detail < 2 // only single click on a selection can work\n\t\t\t&& !this._isActive // the mouse is not down yet\n\t\t\t&& !this._currentSelection.isEmpty() // we don't drag single cursor\n\t\t\t&& (position.type === MouseTargetType.CONTENT_TEXT) // single click on text\n\t\t\t&& position.position && this._currentSelection.containsPosition(position.position) // single click on a selection\n\t\t) {\n\t\t\tthis._mouseState.isDragAndDrop = true;\n\t\t\tthis._isActive = true;\n\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t(browserEvent?: MouseEvent | KeyboardEvent) => {\n\t\t\t\t\tconst position = this._findMousePosition(this._lastMouseEvent!, false);\n\n\t\t\t\t\tif (dom.isKeyboardEvent(browserEvent)) {\n\t\t\t\t\t\t// cancel\n\t\t\t\t\t\tthis._viewController.emitMouseDropCanceled();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._viewController.emitMouseDrop({\n\t\t\t\t\t\t\tevent: this._lastMouseEvent!,\n\t\t\t\t\t\t\ttarget: (position ? this._createMouseTarget(this._lastMouseEvent!, true) : null) // Ignoring because position is unknown, e.g., Content View Zone\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._stop();\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mouseState.isDragAndDrop = false;\n\t\tthis._dispatchMouse(position, e.shiftKey, NavigationCommandRevealType.Minimal);\n\n\t\tif (!this._isActive) {\n\t\t\tthis._isActive = true;\n\t\t\tthis._mouseMoveMonitor.startMonitoring(\n\t\t\t\tthis._viewHelper.viewLinesDomNode,\n\t\t\t\tpointerId,\n\t\t\t\te.buttons,\n\t\t\t\t(e) => this._onMouseDownThenMove(e),\n\t\t\t\t() => this._stop()\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _stop(): void {\n\t\tthis._isActive = false;\n\t\tthis._topBottomDragScrolling.stop();\n\t\tthis._leftRightDragScrolling.stop();\n\t}\n\n\tpublic onHeightChanged(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onPointerUp(): void {\n\t\tthis._mouseMoveMonitor.stopMonitoring();\n\t}\n\n\tpublic onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): void {\n\t\tthis._currentSelection = e.selections[0];\n\t}\n\n\tprivate _getPositionOutsideEditor(e: EditorMouseEvent): IMouseTarget | null {\n\t\tconst editorContent = e.editorPos;\n\t\tconst model = this._context.viewModel;\n\t\tconst viewLayout = this._context.viewLayout;\n\n\t\tconst mouseColumn = this._getMouseColumn(e);\n\n\t\tif (e.posy < editorContent.y) {\n\t\t\tconst outsideDistance = editorContent.y - e.posy;\n\t\t\tconst verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - outsideDistance, 0);\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'above', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(aboveLineNumber, 1), 'above', outsideDistance);\n\t\t}\n\n\t\tif (e.posy > editorContent.y + editorContent.height) {\n\t\t\tconst outsideDistance = e.posy - editorContent.y - editorContent.height;\n\t\t\tconst verticalOffset = viewLayout.getCurrentScrollTop() + e.relativePos.y;\n\t\t\tconst viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n\t\t\tif (viewZoneData) {\n\t\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n\t\t\t\tif (newPosition) {\n\t\t\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'below', outsideDistance);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)), 'below', outsideDistance);\n\t\t}\n\n\t\tconst possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + e.relativePos.y);\n\n\t\tconst layoutInfo = this._context.configuration.options.get(EditorOption.layoutInfo);\n\n\t\tconst xLeftBoundary = layoutInfo.contentLeft;\n\t\tif (e.relativePos.x <= xLeftBoundary) {\n\t\t\tconst outsideDistance = xLeftBoundary - e.relativePos.x;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? model.getLineMaxColumn(possibleLineNumber) : 1), 'left', outsideDistance);\n\t\t}\n\n\t\tconst contentRight = (\n\t\t\tlayoutInfo.minimap.minimapLeft === 0\n\t\t\t\t? layoutInfo.width - layoutInfo.verticalScrollbarWidth // Happens when minimap is hidden\n\t\t\t\t: layoutInfo.minimap.minimapLeft\n\t\t);\n\t\tconst xRightBoundary = contentRight;\n\t\tif (e.relativePos.x >= xRightBoundary) {\n\t\t\tconst outsideDistance = e.relativePos.x - xRightBoundary;\n\t\t\tconst isRtl = model.getTextDirection(possibleLineNumber) === TextDirection.RTL;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, isRtl ? 1 : model.getLineMaxColumn(possibleLineNumber)), 'right', outsideDistance);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate _findMousePosition(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget | null {\n\t\tconst positionOutsideEditor = this._getPositionOutsideEditor(e);\n\t\tif (positionOutsideEditor) {\n\t\t\treturn positionOutsideEditor;\n\t\t}\n\n\t\tconst t = this._createMouseTarget(e, testEventTarget);\n\t\tconst hintedPosition = t.position;\n\t\tif (!hintedPosition) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE) {\n\t\t\tconst newPosition = this._helpPositionJumpOverViewZone(t.detail);\n\t\t\tif (newPosition) {\n\t\t\t\treturn MouseTarget.createViewZone(t.type, t.element, t.mouseColumn, newPosition, t.detail);\n\t\t\t}\n\t\t}\n\n\t\treturn t;\n\t}\n\n\tprivate _helpPositionJumpOverViewZone(viewZoneData: IMouseTargetViewZoneData): Position | null {\n\t\t// Force position on view zones to go above or below depending on where selection started from\n\t\tconst selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);\n\t\tconst positionBefore = viewZoneData.positionBefore;\n\t\tconst positionAfter = viewZoneData.positionAfter;\n\n\t\tif (positionBefore && positionAfter) {\n\t\t\tif (positionBefore.isBefore(selectionStart)) {\n\t\t\t\treturn positionBefore;\n\t\t\t} else {\n\t\t\t\treturn positionAfter;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate _dispatchMouse(position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType): void {\n\t\tif (!position.position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._viewController.dispatchMouse({\n\t\t\tposition: position.position,\n\t\t\tmouseColumn: position.mouseColumn,\n\t\t\tstartedOnLineNumbers: this._mouseState.startedOnLineNumbers,\n\t\t\trevealType,\n\n\t\t\tinSelectionMode: inSelectionMode,\n\t\t\tmouseDownCount: this._mouseState.count,\n\t\t\taltKey: this._mouseState.altKey,\n\t\t\tctrlKey: this._mouseState.ctrlKey,\n\t\t\tmetaKey: this._mouseState.metaKey,\n\t\t\tshiftKey: this._mouseState.shiftKey,\n\n\t\t\tleftButton: this._mouseState.leftButton,\n\t\t\tmiddleButton: this._mouseState.middleButton,\n\n\t\t\tonInjectedText: position.type === MouseTargetType.CONTENT_TEXT && position.detail.injectedText !== null\n\t\t});\n\t}\n}\n\nclass MouseDownState {\n\n\tprivate static readonly CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms\n\n\tprivate _altKey: boolean;\n\tpublic get altKey(): boolean { return this._altKey; }\n\n\tprivate _ctrlKey: boolean;\n\tpublic get ctrlKey(): boolean { return this._ctrlKey; }\n\n\tprivate _metaKey: boolean;\n\tpublic get metaKey(): boolean { return this._metaKey; }\n\n\tprivate _shiftKey: boolean;\n\tpublic get shiftKey(): boolean { return this._shiftKey; }\n\n\tprivate _leftButton: boolean;\n\tpublic get leftButton(): boolean { return this._leftButton; }\n\n\tprivate _middleButton: boolean;\n\tpublic get middleButton(): boolean { return this._middleButton; }\n\n\tprivate _startedOnLineNumbers: boolean;\n\tpublic get startedOnLineNumbers(): boolean { return this._startedOnLineNumbers; }\n\n\tprivate _lastMouseDownPosition: Position | null;\n\tprivate _lastMouseDownPositionEqualCount: number;\n\tprivate _lastMouseDownCount: number;\n\tprivate _lastSetMouseDownCountTime: number;\n\tpublic isDragAndDrop: boolean;\n\n\tconstructor() {\n\t\tthis._altKey = false;\n\t\tthis._ctrlKey = false;\n\t\tthis._metaKey = false;\n\t\tthis._shiftKey = false;\n\t\tthis._leftButton = false;\n\t\tthis._middleButton = false;\n\t\tthis._startedOnLineNumbers = false;\n\t\tthis._lastMouseDownPosition = null;\n\t\tthis._lastMouseDownPositionEqualCount = 0;\n\t\tthis._lastMouseDownCount = 0;\n\t\tthis._lastSetMouseDownCountTime = 0;\n\t\tthis.isDragAndDrop = false;\n\t}\n\n\tpublic get count(): number {\n\t\treturn this._lastMouseDownCount;\n\t}\n\n\tpublic setModifiers(source: EditorMouseEvent) {\n\t\tthis._altKey = source.altKey;\n\t\tthis._ctrlKey = source.ctrlKey;\n\t\tthis._metaKey = source.metaKey;\n\t\tthis._shiftKey = source.shiftKey;\n\t}\n\n\tpublic setStartButtons(source: EditorMouseEvent) {\n\t\tthis._leftButton = source.leftButton;\n\t\tthis._middleButton = source.middleButton;\n\t}\n\n\tpublic setStartedOnLineNumbers(startedOnLineNumbers: boolean): void {\n\t\tthis._startedOnLineNumbers = startedOnLineNumbers;\n\t}\n\n\tpublic trySetCount(setMouseDownCount: number, newMouseDownPosition: Position): void {\n\t\t// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tconst currentTime = (new Date()).getTime();\n\t\tif (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {\n\t\t\tsetMouseDownCount = 1;\n\t\t}\n\t\tthis._lastSetMouseDownCountTime = currentTime;\n\n\t\t// b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n\t\tif (setMouseDownCount > this._lastMouseDownCount + 1) {\n\t\t\tsetMouseDownCount = this._lastMouseDownCount + 1;\n\t\t}\n\n\t\t// c. Invalidate multiple clicking if the logical position is different\n\t\tif (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {\n\t\t\tthis._lastMouseDownPositionEqualCount++;\n\t\t} else {\n\t\t\tthis._lastMouseDownPositionEqualCount = 1;\n\t\t}\n\t\tthis._lastMouseDownPosition = newMouseDownPosition;\n\n\t\t// Finally set the lastMouseDownCount\n\t\tthis._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);\n\t}\n\n}\n"]}
|
|
@@ -557,6 +557,12 @@ export class MouseTargetFactory {
|
|
|
557
557
|
}
|
|
558
558
|
offset -= ctx.layoutInfo.lineNumbersWidth;
|
|
559
559
|
// On the line decorations
|
|
560
|
+
if (!res.isAfterLines && !request.target.classList.contains('cldr')) {
|
|
561
|
+
// No line decoration (see `LinesDecorationsOverlay`) is under the mouse, so behave like a click on the content left of the text
|
|
562
|
+
const lineNumber = pos.lineNumber;
|
|
563
|
+
const column = ctx.isRtl(lineNumber) ? ctx.viewModel.getLineMaxColumn(lineNumber) : ctx.viewModel.getLineMinColumn(lineNumber);
|
|
564
|
+
return request.fulfillContentEmpty(new Position(lineNumber, column), { isAfterLines: false });
|
|
565
|
+
}
|
|
560
566
|
return request.fulfillMargin(4 /* MouseTargetType.GUTTER_LINE_DECORATIONS */, pos, res.range, detail);
|
|
561
567
|
}
|
|
562
568
|
return null;
|
|
@@ -600,13 +606,16 @@ export class MouseTargetFactory {
|
|
|
600
606
|
}
|
|
601
607
|
}
|
|
602
608
|
else {
|
|
609
|
+
// The event targets the `.view-lines` container itself. This always happens with the GPU renderer,
|
|
610
|
+
// and with the DOM renderer at a sub-pixel edge of the lines, where the browser hit tests at whole
|
|
611
|
+
// pixels while the mouse offset still maps into a line. An empty line has no text to hit test
|
|
612
|
+
const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
|
|
613
|
+
if (ctx.viewModel.getLineLength(lineNumber) === 0) {
|
|
614
|
+
const lineWidth = ctx.getLineWidth(lineNumber);
|
|
615
|
+
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
|
|
616
|
+
return request.fulfillContentEmpty(new Position(lineNumber, 1), detail);
|
|
617
|
+
}
|
|
603
618
|
if (ctx.viewLinesGpu) {
|
|
604
|
-
const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
|
|
605
|
-
if (ctx.viewModel.getLineLength(lineNumber) === 0) {
|
|
606
|
-
const lineWidth = ctx.getLineWidth(lineNumber);
|
|
607
|
-
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
|
|
608
|
-
return request.fulfillContentEmpty(new Position(lineNumber, 1), detail);
|
|
609
|
-
}
|
|
610
619
|
const lineWidth = ctx.getLineWidth(lineNumber);
|
|
611
620
|
const isRtl = ctx.isRtl(lineNumber);
|
|
612
621
|
if (isRtl) {
|