monaco-editor-core 0.53.0-dev-20250903 → 0.53.0-dev-20250905

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.
Files changed (51) hide show
  1. package/esm/nls.keys.json +1 -1
  2. package/esm/nls.messages.de.js +2 -2
  3. package/esm/nls.messages.es.js +2 -2
  4. package/esm/nls.messages.fr.js +2 -2
  5. package/esm/nls.messages.it.js +2 -2
  6. package/esm/nls.messages.ja.js +2 -2
  7. package/esm/nls.messages.js +1 -1
  8. package/esm/nls.messages.json +1 -1
  9. package/esm/nls.messages.ko.js +2 -2
  10. package/esm/nls.messages.ru.js +2 -2
  11. package/esm/nls.messages.zh-cn.js +2 -2
  12. package/esm/nls.messages.zh-tw.js +2 -2
  13. package/esm/nls.metadata.json +2 -0
  14. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +2 -0
  15. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
  16. package/esm/vs/editor/browser/controller/mouseHandler.js +2 -3
  17. package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
  18. package/esm/vs/editor/browser/viewParts/minimap/minimap.css +1 -0
  19. package/esm/vs/editor/common/core/edits/stringEdit.js +1 -1
  20. package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
  21. package/esm/vs/platform/contextkey/common/contextkeys.js +2 -1
  22. package/esm/vs/platform/contextkey/common/contextkeys.js.map +1 -1
  23. package/esm/vs/platform/contextkey/common/scanner.js +5 -5
  24. package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
  25. package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
  26. package/esm/vs/platform/list/browser/listService.js +27 -27
  27. package/esm/vs/platform/markers/common/markerService.js +2 -2
  28. package/esm/vs/platform/markers/common/markers.js +6 -6
  29. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +7 -7
  30. package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
  31. package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
  32. package/esm/vs/platform/quickinput/browser/quickInputActions.js +3 -3
  33. package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
  34. package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
  35. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  36. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
  37. package/esm/vs/platform/theme/common/colorUtils.js +2 -2
  38. package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
  39. package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
  40. package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
  41. package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
  42. package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
  43. package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
  44. package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
  45. package/esm/vs/platform/theme/common/colors/miscColors.js +15 -15
  46. package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
  47. package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
  48. package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
  49. package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
  50. package/esm/vs/platform/workspace/common/workspace.js +1 -1
  51. package/package.json +2 -2
@@ -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,EA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AAG,oBAAoB,CAAC;IACnD,CAAC;IAEM,WAAW,CAAC,iBAAyB,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';\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 = 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\ttarget = (<any>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);\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(<string>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 override dispose(): void {\n\t\tsuper.dispose();\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 horizontalScrollPadding = 10;\n\t\tconst layoutInfo = this._context.configuration.options.get(EditorOption.layoutInfo);\n\n\t\tconst xLeftBoundary = layoutInfo.contentLeft + horizontalScrollPadding;\n\t\tif (e.relativePos.x <= xLeftBoundary) {\n\t\t\tconst outsideDistance = xLeftBoundary - e.relativePos.x;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(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 - horizontalScrollPadding;\n\t\tif (e.relativePos.x >= xRightBoundary) {\n\t\t\tconst outsideDistance = e.relativePos.x - xRightBoundary;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, 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';\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 = 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\ttarget = (<any>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);\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(<string>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 override dispose(): void {\n\t\tsuper.dispose();\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 horizontalScrollPadding = 10;\n\t\tconst layoutInfo = this._context.configuration.options.get(EditorOption.layoutInfo);\n\n\t\tconst xLeftBoundary = layoutInfo.contentLeft + horizontalScrollPadding;\n\t\tif (e.relativePos.x <= xLeftBoundary) {\n\t\t\tconst outsideDistance = xLeftBoundary - e.relativePos.x;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(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 - horizontalScrollPadding;\n\t\tif (e.relativePos.x >= xRightBoundary) {\n\t\t\tconst outsideDistance = e.relativePos.x - xRightBoundary;\n\t\t\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, 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/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,CA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AG,oBAAoB,CAAC;IACnD,CAAC;IAEM,WAAW,CAAC,iBAAyB,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';\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 = 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\ttarget = (<any>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);\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(<string>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 override dispose(): void {\n\t\tsuper.dispose();\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\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(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\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, 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';\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 = 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\ttarget = (<any>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);\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(<string>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 override dispose(): void {\n\t\tsuper.dispose();\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\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(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\treturn MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, 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"]}
@@ -35,6 +35,7 @@
35
35
  position: absolute;
36
36
  left: -6px;
37
37
  width: 6px;
38
+ pointer-events: none;
38
39
  }
39
40
  .monaco-editor.no-minimap-shadow .minimap-shadow-visible {
40
41
  position: absolute;
@@ -25,7 +25,7 @@ export class BaseStringReplacement extends BaseReplacement {
25
25
  }
26
26
  getNewLength() { return this.newText.length; }
27
27
  toString() {
28
- return `${this.replaceRange} -> "${this.newText}"`;
28
+ return `${this.replaceRange} -> ${JSON.stringify(this.newText)}`;
29
29
  }
30
30
  replace(str) {
31
31
  return str.substring(0, this.replaceRange.start) + this.newText + str.substring(this.replaceRange.endExclusive);
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/core/edits/stringEdit.ts","vs/editor/common/core/edits/stringEdit.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtD,MAAM,OAAgB,cAAmJ,SAAQ,QAAkB;IAE3L,KAAK,CAAC,IAAY;QACxB,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9D,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;QACtC,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;CACD;AAED,MAAM,OAAgB,qBAAuF,SAAQ,eAAkB;IACtI,YACC,KAAkB,EACF,OAAe;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAFG,YAAO,GAAP,OAAO,CAAQ;IAGhC,CAAC;IAED,YAAY,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7C,QAAQ;QAChB,OAAO,GAAG,IAAI,CAAC,YAAY,QAAQ,IAAI,CAAC,OAAO,GAAG,C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IAC9B,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","file":"stringEdit.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 { commonPrefixLength, commonSuffixLength } from '../../../../base/common/strings.js';\nimport { OffsetRange } from '../ranges/offsetRange.js';\nimport { BaseEdit, BaseReplacement } from './edit.js';\n\n\nexport abstract class BaseStringEdit<T extends BaseStringReplacement<T> = BaseStringReplacement<any>, TEdit extends BaseStringEdit<T, TEdit> = BaseStringEdit<any, any>> extends BaseEdit<T, TEdit> {\n\n\tpublic apply(base: string): string {\n\t\tconst resultText: string[] = [];\n\t\tlet pos = 0;\n\t\tfor (const edit of this.replacements) {\n\t\t\tresultText.push(base.substring(pos, edit.replaceRange.start));\n\t\t\tresultText.push(edit.newText);\n\t\t\tpos = edit.replaceRange.endExclusive;\n\t\t}\n\t\tresultText.push(base.substring(pos));\n\t\treturn resultText.join('');\n\t}\n}\n\nexport abstract class BaseStringReplacement<T extends BaseStringReplacement<T> = BaseStringReplacement<any>> extends BaseReplacement<T> {\n\tconstructor(\n\t\trange: OffsetRange,\n\t\tpublic readonly newText: string\n\t) {\n\t\tsuper(range);\n\t}\n\n\tgetNewLength(): number { return this.newText.length; }\n\n\toverride toString(): string {\n\t\treturn `${this.replaceRange} -> \"${this.newText}\"`;\n\t}\n\n\treplace(str: string): string {\n\t\treturn str.substring(0, this.replaceRange.start) + this.newText + str.substring(this.replaceRange.endExclusive);\n\t}\n\n\tremoveCommonSuffixPrefix(originalText: string): StringReplacement {\n\t\tconst oldText = originalText.substring(this.replaceRange.start, this.replaceRange.endExclusive);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tconst suffixLen = Math.min(\n\t\t\toldText.length - prefixLen,\n\t\t\tthis.newText.length - prefixLen,\n\t\t\tcommonSuffixLength(oldText, this.newText)\n\t\t);\n\n\t\tconst replaceRange = new OffsetRange(\n\t\t\tthis.replaceRange.start + prefixLen,\n\t\t\tthis.replaceRange.endExclusive - suffixLen,\n\t\t);\n\t\tconst newText = this.newText.substring(prefixLen, this.newText.length - suffixLen);\n\n\t\treturn new StringReplacement(replaceRange, newText);\n\t}\n\n\tpublic removeCommonSuffixAndPrefix(source: string): T {\n\t\treturn this.removeCommonSuffix(source).removeCommonPrefix(source);\n\t}\n\n\tpublic removeCommonPrefix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tif (prefixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\n\t\treturn this.slice(this.replaceRange.deltaStart(prefixLen), new OffsetRange(prefixLen, this.newText.length));\n\t}\n\n\tpublic removeCommonSuffix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst suffixLen = commonSuffixLength(oldText, this.newText);\n\t\tif (suffixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\t\treturn this.slice(this.replaceRange.deltaEnd(-suffixLen), new OffsetRange(0, this.newText.length - suffixLen));\n\t}\n\n\tpublic toJson(): ISerializedStringReplacement {\n\t\treturn ({\n\t\t\ttxt: this.newText,\n\t\t\tpos: this.replaceRange.start,\n\t\t\tlen: this.replaceRange.length,\n\t\t});\n\t}\n}\n\n\n/**\n * Represents a set of replacements to a string.\n * All these replacements are applied at once.\n*/\nexport class StringEdit extends BaseStringEdit<StringReplacement, StringEdit> {\n\tpublic static readonly empty = new StringEdit([]);\n\n\tpublic static compose(edits: readonly StringEdit[]): StringEdit {\n\t\tif (edits.length === 0) {\n\t\t\treturn StringEdit.empty;\n\t\t}\n\t\tlet result = edits[0];\n\t\tfor (let i = 1; i < edits.length; i++) {\n\t\t\tresult = result.compose(edits[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tconstructor(replacements: readonly StringReplacement[]) {\n\t\tsuper(replacements);\n\t}\n\n\tprotected override _createNew(replacements: readonly StringReplacement[]): StringEdit {\n\t\treturn new StringEdit(replacements);\n\t}\n}\n\n/**\n * Warning: Be careful when changing this type, as it is used for serialization!\n*/\nexport interface ISerializedStringReplacement {\n\ttxt: string;\n\tpos: number;\n\tlen: number;\n}\n\nexport class StringReplacement extends BaseStringReplacement<StringReplacement> {\n\tpublic static insert(offset: number, text: string): StringReplacement {\n\t\treturn new StringReplacement(OffsetRange.emptyAt(offset), text);\n\t}\n\n\tpublic static replace(range: OffsetRange, text: string): StringReplacement {\n\t\treturn new StringReplacement(range, text);\n\t}\n\n\toverride equals(other: StringReplacement): boolean {\n\t\treturn this.replaceRange.equals(other.replaceRange) && this.newText === other.newText;\n\t}\n\n\toverride tryJoinTouching(other: StringReplacement): StringReplacement | undefined {\n\t\treturn new StringReplacement(this.replaceRange.joinRightTouching(other.replaceRange), this.newText + other.newText);\n\t}\n\n\toverride slice(range: OffsetRange, rangeInReplacement?: OffsetRange): StringReplacement {\n\t\treturn new StringReplacement(range, rangeInReplacement ? rangeInReplacement.substring(this.newText) : this.newText);\n\t}\n}\n\nexport function applyEditsToRanges(sortedRanges: OffsetRange[], edit: StringEdit): OffsetRange[] {\n\tsortedRanges = sortedRanges.slice();\n\n\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\tconst result: OffsetRange[] = [];\n\n\tlet offset = 0;\n\n\tfor (const e of edit.replacements) {\n\t\twhile (true) {\n\t\t\t// ranges before the current edit\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || r.endExclusive >= e.replaceRange.start) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tresult.push(r.delta(offset));\n\t\t}\n\n\t\tconst intersecting: OffsetRange[] = [];\n\t\twhile (true) {\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || !r.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tintersecting.push(r);\n\t\t}\n\n\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\tlet r = intersecting[i];\n\n\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\tr = r.deltaEnd(-overlap + (i === 0 ? e.newText.length : 0));\n\n\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t}\n\n\t\t\tif (i !== 0) {\n\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t}\n\n\t\t\t// We already took our offset into account.\n\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t// we have to remove it here.\n\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\tsortedRanges.unshift(r);\n\t\t}\n\n\t\toffset += e.newText.length - e.replaceRange.length;\n\t}\n\n\twhile (true) {\n\t\tconst r = sortedRanges[0];\n\t\tif (!r) {\n\t\t\tbreak;\n\t\t}\n\t\tsortedRanges.shift();\n\t\tresult.push(r.delta(offset));\n\t}\n\n\treturn result;\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 { commonPrefixLength, commonSuffixLength } from '../../../../base/common/strings.js';\nimport { OffsetRange } from '../ranges/offsetRange.js';\nimport { BaseEdit, BaseReplacement } from './edit.js';\n\n\nexport abstract class BaseStringEdit<T extends BaseStringReplacement<T> = BaseStringReplacement<any>, TEdit extends BaseStringEdit<T, TEdit> = BaseStringEdit<any, any>> extends BaseEdit<T, TEdit> {\n\n\tpublic apply(base: string): string {\n\t\tconst resultText: string[] = [];\n\t\tlet pos = 0;\n\t\tfor (const edit of this.replacements) {\n\t\t\tresultText.push(base.substring(pos, edit.replaceRange.start));\n\t\t\tresultText.push(edit.newText);\n\t\t\tpos = edit.replaceRange.endExclusive;\n\t\t}\n\t\tresultText.push(base.substring(pos));\n\t\treturn resultText.join('');\n\t}\n}\n\nexport abstract class BaseStringReplacement<T extends BaseStringReplacement<T> = BaseStringReplacement<any>> extends BaseReplacement<T> {\n\tconstructor(\n\t\trange: OffsetRange,\n\t\tpublic readonly newText: string\n\t) {\n\t\tsuper(range);\n\t}\n\n\tgetNewLength(): number { return this.newText.length; }\n\n\toverride toString(): string {\n\t\treturn `${this.replaceRange} -> \"${this.newText}\"`;\n\t}\n\n\treplace(str: string): string {\n\t\treturn str.substring(0, this.replaceRange.start) + this.newText + str.substring(this.replaceRange.endExclusive);\n\t}\n\n\tremoveCommonSuffixPrefix(originalText: string): StringReplacement {\n\t\tconst oldText = originalText.substring(this.replaceRange.start, this.replaceRange.endExclusive);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tconst suffixLen = Math.min(\n\t\t\toldText.length - prefixLen,\n\t\t\tthis.newText.length - prefixLen,\n\t\t\tcommonSuffixLength(oldText, this.newText)\n\t\t);\n\n\t\tconst replaceRange = new OffsetRange(\n\t\t\tthis.replaceRange.start + prefixLen,\n\t\t\tthis.replaceRange.endExclusive - suffixLen,\n\t\t);\n\t\tconst newText = this.newText.substring(prefixLen, this.newText.length - suffixLen);\n\n\t\treturn new StringReplacement(replaceRange, newText);\n\t}\n\n\tpublic removeCommonSuffixAndPrefix(source: string): T {\n\t\treturn this.removeCommonSuffix(source).removeCommonPrefix(source);\n\t}\n\n\tpublic removeCommonPrefix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tif (prefixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\n\t\treturn this.slice(this.replaceRange.deltaStart(prefixLen), new OffsetRange(prefixLen, this.newText.length));\n\t}\n\n\tpublic removeCommonSuffix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst suffixLen = commonSuffixLength(oldText, this.newText);\n\t\tif (suffixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\t\treturn this.slice(this.replaceRange.deltaEnd(-suffixLen), new OffsetRange(0, this.newText.length - suffixLen));\n\t}\n\n\tpublic toJson(): ISerializedStringReplacement {\n\t\treturn ({\n\t\t\ttxt: this.newText,\n\t\t\tpos: this.replaceRange.start,\n\t\t\tlen: this.replaceRange.length,\n\t\t});\n\t}\n}\n\n\n/**\n * Represents a set of replacements to a string.\n * All these replacements are applied at once.\n*/\nexport class StringEdit extends BaseStringEdit<StringReplacement, StringEdit> {\n\tpublic static readonly empty = new StringEdit([]);\n\n\tpublic static compose(edits: readonly StringEdit[]): StringEdit {\n\t\tif (edits.length === 0) {\n\t\t\treturn StringEdit.empty;\n\t\t}\n\t\tlet result = edits[0];\n\t\tfor (let i = 1; i < edits.length; i++) {\n\t\t\tresult = result.compose(edits[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tconstructor(replacements: readonly StringReplacement[]) {\n\t\tsuper(replacements);\n\t}\n\n\tprotected override _createNew(replacements: readonly StringReplacement[]): StringEdit {\n\t\treturn new StringEdit(replacements);\n\t}\n}\n\n/**\n * Warning: Be careful when changing this type, as it is used for serialization!\n*/\nexport interface ISerializedStringReplacement {\n\ttxt: string;\n\tpos: number;\n\tlen: number;\n}\n\nexport class StringReplacement extends BaseStringReplacement<StringReplacement> {\n\tpublic static insert(offset: number, text: string): StringReplacement {\n\t\treturn new StringReplacement(OffsetRange.emptyAt(offset), text);\n\t}\n\n\tpublic static replace(range: OffsetRange, text: string): StringReplacement {\n\t\treturn new StringReplacement(range, text);\n\t}\n\n\toverride equals(other: StringReplacement): boolean {\n\t\treturn this.replaceRange.equals(other.replaceRange) && this.newText === other.newText;\n\t}\n\n\toverride tryJoinTouching(other: StringReplacement): StringReplacement | undefined {\n\t\treturn new StringReplacement(this.replaceRange.joinRightTouching(other.replaceRange), this.newText + other.newText);\n\t}\n\n\toverride slice(range: OffsetRange, rangeInReplacement?: OffsetRange): StringReplacement {\n\t\treturn new StringReplacement(range, rangeInReplacement ? rangeInReplacement.substring(this.newText) : this.newText);\n\t}\n}\n\nexport function applyEditsToRanges(sortedRanges: OffsetRange[], edit: StringEdit): OffsetRange[] {\n\tsortedRanges = sortedRanges.slice();\n\n\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\tconst result: OffsetRange[] = [];\n\n\tlet offset = 0;\n\n\tfor (const e of edit.replacements) {\n\t\twhile (true) {\n\t\t\t// ranges before the current edit\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || r.endExclusive >= e.replaceRange.start) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tresult.push(r.delta(offset));\n\t\t}\n\n\t\tconst intersecting: OffsetRange[] = [];\n\t\twhile (true) {\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || !r.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tintersecting.push(r);\n\t\t}\n\n\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\tlet r = intersecting[i];\n\n\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\tr = r.deltaEnd(-overlap + (i === 0 ? e.newText.length : 0));\n\n\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t}\n\n\t\t\tif (i !== 0) {\n\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t}\n\n\t\t\t// We already took our offset into account.\n\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t// we have to remove it here.\n\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\tsortedRanges.unshift(r);\n\t\t}\n\n\t\toffset += e.newText.length - e.replaceRange.length;\n\t}\n\n\twhile (true) {\n\t\tconst r = sortedRanges[0];\n\t\tif (!r) {\n\t\t\tbreak;\n\t\t}\n\t\tsortedRanges.shift();\n\t\tresult.push(r.delta(offset));\n\t}\n\n\treturn result;\n}\n\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/core/edits/stringEdit.ts","vs/editor/common/core/edits/stringEdit.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtD,MAAM,OAAgB,cAAmJ,SAAQ,QAAkB;IAE3L,KAAK,CAAC,IAAY;QACxB,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9D,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;QACtC,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;CACD;AAED,MAAM,OAAgB,qBAAuF,SAAQ,eAAkB;IACtI,YACC,KAAkB,EACF,OAAe;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAFG,YAAO,GAAP,OAAO,CAAQ;IAGhC,CAAC;IAED,YA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AC;QAC1B,IAAI,CAAC,CAAC,EAAE,CAAC;YACR,MAAM;QACP,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","file":"stringEdit.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 { commonPrefixLength, commonSuffixLength } from '../../../../base/common/strings.js';\nimport { OffsetRange } from '../ranges/offsetRange.js';\nimport { BaseEdit, BaseReplacement } from './edit.js';\n\n\nexport abstract class BaseStringEdit<T extends BaseStringReplacement<T> = BaseStringReplacement<any>, TEdit extends BaseStringEdit<T, TEdit> = BaseStringEdit<any, any>> extends BaseEdit<T, TEdit> {\n\n\tpublic apply(base: string): string {\n\t\tconst resultText: string[] = [];\n\t\tlet pos = 0;\n\t\tfor (const edit of this.replacements) {\n\t\t\tresultText.push(base.substring(pos, edit.replaceRange.start));\n\t\t\tresultText.push(edit.newText);\n\t\t\tpos = edit.replaceRange.endExclusive;\n\t\t}\n\t\tresultText.push(base.substring(pos));\n\t\treturn resultText.join('');\n\t}\n}\n\nexport abstract class BaseStringReplacement<T extends BaseStringReplacement<T> = BaseStringReplacement<any>> extends BaseReplacement<T> {\n\tconstructor(\n\t\trange: OffsetRange,\n\t\tpublic readonly newText: string\n\t) {\n\t\tsuper(range);\n\t}\n\n\tgetNewLength(): number { return this.newText.length; }\n\n\toverride toString(): string {\n\t\treturn `${this.replaceRange} -> ${JSON.stringify(this.newText)}`;\n\t}\n\n\treplace(str: string): string {\n\t\treturn str.substring(0, this.replaceRange.start) + this.newText + str.substring(this.replaceRange.endExclusive);\n\t}\n\n\tremoveCommonSuffixPrefix(originalText: string): StringReplacement {\n\t\tconst oldText = originalText.substring(this.replaceRange.start, this.replaceRange.endExclusive);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tconst suffixLen = Math.min(\n\t\t\toldText.length - prefixLen,\n\t\t\tthis.newText.length - prefixLen,\n\t\t\tcommonSuffixLength(oldText, this.newText)\n\t\t);\n\n\t\tconst replaceRange = new OffsetRange(\n\t\t\tthis.replaceRange.start + prefixLen,\n\t\t\tthis.replaceRange.endExclusive - suffixLen,\n\t\t);\n\t\tconst newText = this.newText.substring(prefixLen, this.newText.length - suffixLen);\n\n\t\treturn new StringReplacement(replaceRange, newText);\n\t}\n\n\tpublic removeCommonSuffixAndPrefix(source: string): T {\n\t\treturn this.removeCommonSuffix(source).removeCommonPrefix(source);\n\t}\n\n\tpublic removeCommonPrefix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tif (prefixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\n\t\treturn this.slice(this.replaceRange.deltaStart(prefixLen), new OffsetRange(prefixLen, this.newText.length));\n\t}\n\n\tpublic removeCommonSuffix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst suffixLen = commonSuffixLength(oldText, this.newText);\n\t\tif (suffixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\t\treturn this.slice(this.replaceRange.deltaEnd(-suffixLen), new OffsetRange(0, this.newText.length - suffixLen));\n\t}\n\n\tpublic toJson(): ISerializedStringReplacement {\n\t\treturn ({\n\t\t\ttxt: this.newText,\n\t\t\tpos: this.replaceRange.start,\n\t\t\tlen: this.replaceRange.length,\n\t\t});\n\t}\n}\n\n\n/**\n * Represents a set of replacements to a string.\n * All these replacements are applied at once.\n*/\nexport class StringEdit extends BaseStringEdit<StringReplacement, StringEdit> {\n\tpublic static readonly empty = new StringEdit([]);\n\n\tpublic static compose(edits: readonly StringEdit[]): StringEdit {\n\t\tif (edits.length === 0) {\n\t\t\treturn StringEdit.empty;\n\t\t}\n\t\tlet result = edits[0];\n\t\tfor (let i = 1; i < edits.length; i++) {\n\t\t\tresult = result.compose(edits[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tconstructor(replacements: readonly StringReplacement[]) {\n\t\tsuper(replacements);\n\t}\n\n\tprotected override _createNew(replacements: readonly StringReplacement[]): StringEdit {\n\t\treturn new StringEdit(replacements);\n\t}\n}\n\n/**\n * Warning: Be careful when changing this type, as it is used for serialization!\n*/\nexport interface ISerializedStringReplacement {\n\ttxt: string;\n\tpos: number;\n\tlen: number;\n}\n\nexport class StringReplacement extends BaseStringReplacement<StringReplacement> {\n\tpublic static insert(offset: number, text: string): StringReplacement {\n\t\treturn new StringReplacement(OffsetRange.emptyAt(offset), text);\n\t}\n\n\tpublic static replace(range: OffsetRange, text: string): StringReplacement {\n\t\treturn new StringReplacement(range, text);\n\t}\n\n\toverride equals(other: StringReplacement): boolean {\n\t\treturn this.replaceRange.equals(other.replaceRange) && this.newText === other.newText;\n\t}\n\n\toverride tryJoinTouching(other: StringReplacement): StringReplacement | undefined {\n\t\treturn new StringReplacement(this.replaceRange.joinRightTouching(other.replaceRange), this.newText + other.newText);\n\t}\n\n\toverride slice(range: OffsetRange, rangeInReplacement?: OffsetRange): StringReplacement {\n\t\treturn new StringReplacement(range, rangeInReplacement ? rangeInReplacement.substring(this.newText) : this.newText);\n\t}\n}\n\nexport function applyEditsToRanges(sortedRanges: OffsetRange[], edit: StringEdit): OffsetRange[] {\n\tsortedRanges = sortedRanges.slice();\n\n\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\tconst result: OffsetRange[] = [];\n\n\tlet offset = 0;\n\n\tfor (const e of edit.replacements) {\n\t\twhile (true) {\n\t\t\t// ranges before the current edit\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || r.endExclusive >= e.replaceRange.start) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tresult.push(r.delta(offset));\n\t\t}\n\n\t\tconst intersecting: OffsetRange[] = [];\n\t\twhile (true) {\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || !r.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tintersecting.push(r);\n\t\t}\n\n\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\tlet r = intersecting[i];\n\n\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\tr = r.deltaEnd(-overlap + (i === 0 ? e.newText.length : 0));\n\n\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t}\n\n\t\t\tif (i !== 0) {\n\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t}\n\n\t\t\t// We already took our offset into account.\n\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t// we have to remove it here.\n\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\tsortedRanges.unshift(r);\n\t\t}\n\n\t\toffset += e.newText.length - e.replaceRange.length;\n\t}\n\n\twhile (true) {\n\t\tconst r = sortedRanges[0];\n\t\tif (!r) {\n\t\t\tbreak;\n\t\t}\n\t\tsortedRanges.shift();\n\t\tresult.push(r.delta(offset));\n\t}\n\n\treturn result;\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 { commonPrefixLength, commonSuffixLength } from '../../../../base/common/strings.js';\nimport { OffsetRange } from '../ranges/offsetRange.js';\nimport { BaseEdit, BaseReplacement } from './edit.js';\n\n\nexport abstract class BaseStringEdit<T extends BaseStringReplacement<T> = BaseStringReplacement<any>, TEdit extends BaseStringEdit<T, TEdit> = BaseStringEdit<any, any>> extends BaseEdit<T, TEdit> {\n\n\tpublic apply(base: string): string {\n\t\tconst resultText: string[] = [];\n\t\tlet pos = 0;\n\t\tfor (const edit of this.replacements) {\n\t\t\tresultText.push(base.substring(pos, edit.replaceRange.start));\n\t\t\tresultText.push(edit.newText);\n\t\t\tpos = edit.replaceRange.endExclusive;\n\t\t}\n\t\tresultText.push(base.substring(pos));\n\t\treturn resultText.join('');\n\t}\n}\n\nexport abstract class BaseStringReplacement<T extends BaseStringReplacement<T> = BaseStringReplacement<any>> extends BaseReplacement<T> {\n\tconstructor(\n\t\trange: OffsetRange,\n\t\tpublic readonly newText: string\n\t) {\n\t\tsuper(range);\n\t}\n\n\tgetNewLength(): number { return this.newText.length; }\n\n\toverride toString(): string {\n\t\treturn `${this.replaceRange} -> ${JSON.stringify(this.newText)}`;\n\t}\n\n\treplace(str: string): string {\n\t\treturn str.substring(0, this.replaceRange.start) + this.newText + str.substring(this.replaceRange.endExclusive);\n\t}\n\n\tremoveCommonSuffixPrefix(originalText: string): StringReplacement {\n\t\tconst oldText = originalText.substring(this.replaceRange.start, this.replaceRange.endExclusive);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tconst suffixLen = Math.min(\n\t\t\toldText.length - prefixLen,\n\t\t\tthis.newText.length - prefixLen,\n\t\t\tcommonSuffixLength(oldText, this.newText)\n\t\t);\n\n\t\tconst replaceRange = new OffsetRange(\n\t\t\tthis.replaceRange.start + prefixLen,\n\t\t\tthis.replaceRange.endExclusive - suffixLen,\n\t\t);\n\t\tconst newText = this.newText.substring(prefixLen, this.newText.length - suffixLen);\n\n\t\treturn new StringReplacement(replaceRange, newText);\n\t}\n\n\tpublic removeCommonSuffixAndPrefix(source: string): T {\n\t\treturn this.removeCommonSuffix(source).removeCommonPrefix(source);\n\t}\n\n\tpublic removeCommonPrefix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst prefixLen = commonPrefixLength(oldText, this.newText);\n\t\tif (prefixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\n\t\treturn this.slice(this.replaceRange.deltaStart(prefixLen), new OffsetRange(prefixLen, this.newText.length));\n\t}\n\n\tpublic removeCommonSuffix(source: string): T {\n\t\tconst oldText = this.replaceRange.substring(source);\n\n\t\tconst suffixLen = commonSuffixLength(oldText, this.newText);\n\t\tif (suffixLen === 0) {\n\t\t\treturn this as unknown as T;\n\t\t}\n\t\treturn this.slice(this.replaceRange.deltaEnd(-suffixLen), new OffsetRange(0, this.newText.length - suffixLen));\n\t}\n\n\tpublic toJson(): ISerializedStringReplacement {\n\t\treturn ({\n\t\t\ttxt: this.newText,\n\t\t\tpos: this.replaceRange.start,\n\t\t\tlen: this.replaceRange.length,\n\t\t});\n\t}\n}\n\n\n/**\n * Represents a set of replacements to a string.\n * All these replacements are applied at once.\n*/\nexport class StringEdit extends BaseStringEdit<StringReplacement, StringEdit> {\n\tpublic static readonly empty = new StringEdit([]);\n\n\tpublic static compose(edits: readonly StringEdit[]): StringEdit {\n\t\tif (edits.length === 0) {\n\t\t\treturn StringEdit.empty;\n\t\t}\n\t\tlet result = edits[0];\n\t\tfor (let i = 1; i < edits.length; i++) {\n\t\t\tresult = result.compose(edits[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tconstructor(replacements: readonly StringReplacement[]) {\n\t\tsuper(replacements);\n\t}\n\n\tprotected override _createNew(replacements: readonly StringReplacement[]): StringEdit {\n\t\treturn new StringEdit(replacements);\n\t}\n}\n\n/**\n * Warning: Be careful when changing this type, as it is used for serialization!\n*/\nexport interface ISerializedStringReplacement {\n\ttxt: string;\n\tpos: number;\n\tlen: number;\n}\n\nexport class StringReplacement extends BaseStringReplacement<StringReplacement> {\n\tpublic static insert(offset: number, text: string): StringReplacement {\n\t\treturn new StringReplacement(OffsetRange.emptyAt(offset), text);\n\t}\n\n\tpublic static replace(range: OffsetRange, text: string): StringReplacement {\n\t\treturn new StringReplacement(range, text);\n\t}\n\n\toverride equals(other: StringReplacement): boolean {\n\t\treturn this.replaceRange.equals(other.replaceRange) && this.newText === other.newText;\n\t}\n\n\toverride tryJoinTouching(other: StringReplacement): StringReplacement | undefined {\n\t\treturn new StringReplacement(this.replaceRange.joinRightTouching(other.replaceRange), this.newText + other.newText);\n\t}\n\n\toverride slice(range: OffsetRange, rangeInReplacement?: OffsetRange): StringReplacement {\n\t\treturn new StringReplacement(range, rangeInReplacement ? rangeInReplacement.substring(this.newText) : this.newText);\n\t}\n}\n\nexport function applyEditsToRanges(sortedRanges: OffsetRange[], edit: StringEdit): OffsetRange[] {\n\tsortedRanges = sortedRanges.slice();\n\n\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\tconst result: OffsetRange[] = [];\n\n\tlet offset = 0;\n\n\tfor (const e of edit.replacements) {\n\t\twhile (true) {\n\t\t\t// ranges before the current edit\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || r.endExclusive >= e.replaceRange.start) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tresult.push(r.delta(offset));\n\t\t}\n\n\t\tconst intersecting: OffsetRange[] = [];\n\t\twhile (true) {\n\t\t\tconst r = sortedRanges[0];\n\t\t\tif (!r || !r.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsortedRanges.shift();\n\t\t\tintersecting.push(r);\n\t\t}\n\n\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\tlet r = intersecting[i];\n\n\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\tr = r.deltaEnd(-overlap + (i === 0 ? e.newText.length : 0));\n\n\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t}\n\n\t\t\tif (i !== 0) {\n\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t}\n\n\t\t\t// We already took our offset into account.\n\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t// we have to remove it here.\n\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\tsortedRanges.unshift(r);\n\t\t}\n\n\t\toffset += e.newText.length - e.replaceRange.length;\n\t}\n\n\twhile (true) {\n\t\tconst r = sortedRanges[0];\n\t\tif (!r) {\n\t\t\tbreak;\n\t\t}\n\t\tsortedRanges.shift();\n\t\tresult.push(r.delta(offset));\n\t}\n\n\treturn result;\n}\n\n"]}
@@ -14,6 +14,7 @@ export const IsIOSContext = new RawContextKey('isIOS', isIOS, localize(1671, "Wh
14
14
  export const IsMobileContext = new RawContextKey('isMobile', isMobile, localize(1672, "Whether the platform is a mobile web browser"));
15
15
  export const IsDevelopmentContext = new RawContextKey('isDevelopment', false, true);
16
16
  export const ProductQualityContext = new RawContextKey('productQualityType', '', localize(1673, "Quality type of VS Code"));
17
+ export const IsSimulationContext = new RawContextKey('isSimulation', false, localize(1674, "Whether the application runs in simulation mode"));
17
18
  export const InputFocusedContextKey = 'inputFocus';
18
- export const InputFocusedContext = new RawContextKey(InputFocusedContextKey, false, localize(1674, "Whether keyboard focus is inside an input box"));
19
+ export const InputFocusedContext = new RawContextKey(InputFocusedContextKey, false, localize(1675, "Whether keyboard focus is inside an input box"));
19
20
  //# sourceMappingURL=contextkeys.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["vs/platform/contextkey/common/contextkeys.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC3G,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,aAAa,CAAU,OAAO,E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EAAE,KAAK,EAAE,QAAQ,CAAC,IAAY,EAAE,+CAA+C,CAAC,CAAC,CAAC","file":"contextkeys.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 { isIOS, isLinux, isMacintosh, isMobile, isWeb, isWindows } from '../../../base/common/platform.js';\nimport { localize } from '../../../nls.js';\nimport { RawContextKey } from './contextkey.js';\n\nexport const IsMacContext = new RawContextKey<boolean>('isMac', isMacintosh, localize('isMac', \"Whether the operating system is macOS\"));\nexport const IsLinuxContext = new RawContextKey<boolean>('isLinux', isLinux, localize('isLinux', \"Whether the operating system is Linux\"));\nexport const IsWindowsContext = new RawContextKey<boolean>('isWindows', isWindows, localize('isWindows', \"Whether the operating system is Windows\"));\n\nexport const IsWebContext = new RawContextKey<boolean>('isWeb', isWeb, localize('isWeb', \"Whether the platform is a web browser\"));\nexport const IsMacNativeContext = new RawContextKey<boolean>('isMacNative', isMacintosh && !isWeb, localize('isMacNative', \"Whether the operating system is macOS on a non-browser platform\"));\nexport const IsIOSContext = new RawContextKey<boolean>('isIOS', isIOS, localize('isIOS', \"Whether the operating system is iOS\"));\nexport const IsMobileContext = new RawContextKey<boolean>('isMobile', isMobile, localize('isMobile', \"Whether the platform is a mobile web browser\"));\n\nexport const IsDevelopmentContext = new RawContextKey<boolean>('isDevelopment', false, true);\nexport const ProductQualityContext = new RawContextKey<string>('productQualityType', '', localize('productQualityType', \"Quality type of VS Code\"));\n\nexport const InputFocusedContextKey = 'inputFocus';\nexport const InputFocusedContext = new RawContextKey<boolean>(InputFocusedContextKey, false, localize('inputFocus', \"Whether keyboard focus is inside an input box\"));\n"]}
1
+ {"version":3,"sources":["vs/platform/contextkey/common/contextkeys.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,E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AAC,CAAC;AAC7F,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,aAAa,CAAS,oBAAoB,EAAE,EAAE,EAAE,QAAQ,CAAC,IAAoB,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAEpJ,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,aAAa,CAAU,cAAc,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAc,EAAE,iDAAiD,CAAC,CAAC,CAAC;AAElK,MAAM,CAAC,MAAM,sBAAsB,GAAG,YAAY,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,aAAa,CAAU,sBAAsB,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAY,EAAE,+CAA+C,CAAC,CAAC,CAAC","file":"contextkeys.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 { isIOS, isLinux, isMacintosh, isMobile, isWeb, isWindows } from '../../../base/common/platform.js';\nimport { localize } from '../../../nls.js';\nimport { RawContextKey } from './contextkey.js';\n\nexport const IsMacContext = new RawContextKey<boolean>('isMac', isMacintosh, localize('isMac', \"Whether the operating system is macOS\"));\nexport const IsLinuxContext = new RawContextKey<boolean>('isLinux', isLinux, localize('isLinux', \"Whether the operating system is Linux\"));\nexport const IsWindowsContext = new RawContextKey<boolean>('isWindows', isWindows, localize('isWindows', \"Whether the operating system is Windows\"));\n\nexport const IsWebContext = new RawContextKey<boolean>('isWeb', isWeb, localize('isWeb', \"Whether the platform is a web browser\"));\nexport const IsMacNativeContext = new RawContextKey<boolean>('isMacNative', isMacintosh && !isWeb, localize('isMacNative', \"Whether the operating system is macOS on a non-browser platform\"));\nexport const IsIOSContext = new RawContextKey<boolean>('isIOS', isIOS, localize('isIOS', \"Whether the operating system is iOS\"));\nexport const IsMobileContext = new RawContextKey<boolean>('isMobile', isMobile, localize('isMobile', \"Whether the platform is a mobile web browser\"));\n\nexport const IsDevelopmentContext = new RawContextKey<boolean>('isDevelopment', false, true);\nexport const ProductQualityContext = new RawContextKey<string>('productQualityType', '', localize('productQualityType', \"Quality type of VS Code\"));\n\nexport const IsSimulationContext = new RawContextKey<boolean>('isSimulation', false, localize('isSimulation', \"Whether the application runs in simulation mode\"));\n\nexport const InputFocusedContextKey = 'inputFocus';\nexport const InputFocusedContext = new RawContextKey<boolean>(InputFocusedContextKey, false, localize('inputFocus', \"Whether keyboard focus is inside an input box\"));\n"]}
@@ -7,17 +7,17 @@ import { localize } from '../../../nls.js';
7
7
  function hintDidYouMean(...meant) {
8
8
  switch (meant.length) {
9
9
  case 1:
10
- return localize(1675, "Did you mean {0}?", meant[0]);
10
+ return localize(1676, "Did you mean {0}?", meant[0]);
11
11
  case 2:
12
- return localize(1676, "Did you mean {0} or {1}?", meant[0], meant[1]);
12
+ return localize(1677, "Did you mean {0} or {1}?", meant[0], meant[1]);
13
13
  case 3:
14
- return localize(1677, "Did you mean {0}, {1} or {2}?", meant[0], meant[1], meant[2]);
14
+ return localize(1678, "Did you mean {0}, {1} or {2}?", meant[0], meant[1], meant[2]);
15
15
  default: // we just don't expect that many
16
16
  return undefined;
17
17
  }
18
18
  }
19
- const hintDidYouForgetToOpenOrCloseQuote = localize(1678, "Did you forget to open or close the quote?");
20
- const hintDidYouForgetToEscapeSlash = localize(1679, "Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/\'.");
19
+ const hintDidYouForgetToOpenOrCloseQuote = localize(1679, "Did you forget to open or close the quote?");
20
+ const hintDidYouForgetToEscapeSlash = localize(1680, "Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/\'.");
21
21
  /**
22
22
  * A simple scanner for context keys.
23
23
  *
@@ -18,7 +18,7 @@ import { KeybindingsRegistry } from '../../keybinding/common/keybindingsRegistry
18
18
  import { localize } from '../../../nls.js';
19
19
  import { DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';
20
20
  import { isActiveElement } from '../../../base/browser/dom.js';
21
- export const historyNavigationVisible = new RawContextKey('suggestWidgetVisible', false, localize(1680, "Whether suggestion are visible"));
21
+ export const historyNavigationVisible = new RawContextKey('suggestWidgetVisible', false, localize(1681, "Whether suggestion are visible"));
22
22
  const HistoryNavigationWidgetFocusContext = 'historyNavigationWidgetFocus';
23
23
  const HistoryNavigationForwardsEnablementContext = 'historyNavigationForwardsEnabled';
24
24
  const HistoryNavigationBackwardsEnablementContext = 'historyNavigationBackwardsEnabled';