monaco-editor-core 0.56.0-dev-20251125 → 0.56.0-dev-20251217
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +30 -4
- package/esm/vs/base/browser/dom.js +1 -4
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +25 -11
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/button/button.js +15 -8
- package/esm/vs/base/browser/ui/button/button.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +3 -8
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/list/list.css +1 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +3 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +11 -2
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/defaultAccount.js +6 -0
- package/esm/vs/base/common/defaultAccount.js.map +1 -0
- package/esm/vs/base/common/equals.js +73 -24
- package/esm/vs/base/common/equals.js.map +1 -1
- package/esm/vs/base/common/event.js +14 -4
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/iterator.js.map +1 -1
- package/esm/vs/base/common/keybindings.js +0 -8
- package/esm/vs/base/common/keybindings.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js +2 -2
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/marshallingIds.js.map +1 -1
- package/esm/vs/base/common/observableInternal/index.js +1 -1
- package/esm/vs/base/common/observableInternal/index.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +16 -0
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/utils/utils.js +11 -0
- package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
- package/esm/vs/base/common/product.js.map +1 -1
- package/esm/vs/base/common/strings.js +3 -1
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +2 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +73 -2
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +7 -51
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/screenReaderUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +7 -20
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +14 -44
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js +19 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map +1 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js +14 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +5 -2
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +32 -15
- package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
- package/esm/vs/editor/browser/view.js +11 -2
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +5 -2
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +10 -0
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/style.css +48 -0
- package/esm/vs/editor/common/config/fontInfo.js +1 -1
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- package/esm/vs/editor/common/core/edits/edit.js +19 -0
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/stringEdit.js +13 -0
- package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/textEdit.js +0 -3
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorWordOperations.js +6 -3
- package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js +2 -2
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js.map +1 -1
- package/esm/vs/editor/common/languages/supports/tokenization.js +3 -0
- package/esm/vs/editor/common/languages/supports/tokenization.js.map +1 -1
- package/esm/vs/editor/common/languages.js +2 -1
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/decorationProvider.js +21 -1
- package/esm/vs/editor/common/model/decorationProvider.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +49 -30
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js +6 -3
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/annotations.js +177 -0
- package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +131 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/textModelEditSource.js +2 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/textModelEvents.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/lineDecorations.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +54 -36
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +14 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -0
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +33 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js +8 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js +198 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js +40 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +128 -70
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +59 -11
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +152 -95
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +113 -54
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +317 -75
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js +20 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +59 -42
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +29 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +78 -46
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +9 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +11 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +81 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js +48 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +18 -15
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js +3 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +4 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +4 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +9 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +203 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js +189 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +85 -102
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +75 -32
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js +121 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +15 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +39 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +10 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +11 -11
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +19 -15
- package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +3 -2
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js.map +1 -1
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js +33 -0
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -0
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -8
- package/esm/vs/editor/contrib/suggest/browser/suggest.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +39 -28
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +1 -0
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +22 -18
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +28 -6
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +19 -2
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +34 -3
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +2 -2
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js +11 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -8
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +11 -5
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/{product/common/productService.js → defaultAccount/common/defaultAccount.js} +2 -2
- package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -0
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -8
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/log/common/log.js +1 -1
- package/esm/vs/platform/log/common/log.js.map +1 -1
- package/esm/vs/platform/markers/common/markerService.js +6 -6
- package/esm/vs/platform/markers/common/markerService.js.map +1 -1
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +7 -3
- package/esm/vs/platform/quickinput/browser/quickInput.js +19 -11
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +18 -17
- package/esm/vs/platform/theme/common/colors/baseColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
- package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +21 -21
- package/esm/vs/platform/undoRedo/common/undoRedoService.js.map +1 -1
- package/esm/vs/platform/window/common/window.js +1 -1
- package/esm/vs/platform/window/common/window.js.map +1 -1
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +34 -3
- package/package.json +2 -2
- package/version.txt +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +0 -16
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +0 -1
- package/esm/vs/platform/product/common/productService.js.map +0 -1
package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/textArea/textAreaEditCont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,YAAY,EAAE,CAAC;YAC1G,YAAY;YACZ,kGAAkG;YAClG,IAAI,OAAO,CAAC,SAAS,IAAI,YAAY,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;gBAC/D,QAAQ,CAAC,KAAK,EAAE,CAAC;YAClB,CAAC;YACD,OAAO;QACR,CAAC;QAED,uGAAuG;QAEvG,IAAI,gBAAgB,EAAE,CAAC;YACtB,4DAA4D;YAC5D,IAAI,CAAC,4BAA4B,CAAC,mBAAmB,CAAC,CAAC;YACvD,QAAQ,CAAC,iBAAiB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YACzD,IAAI,OAAO,CAAC,SAAS,IAAI,YAAY,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;gBAC/D,QAAQ,CAAC,KAAK,EAAE,CAAC;YAClB,CAAC;YACD,OAAO;QACR,CAAC;QAED,8FAA8F;QAC9F,uDAAuD;QACvD,IAAI,CAAC;YACJ,MAAM,WAAW,GAAG,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YACvD,IAAI,CAAC,4BAA4B,CAAC,mBAAmB,CAAC,CAAC;YACvD,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,QAAQ,CAAC,iBAAiB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YACzD,GAAG,CAAC,uBAAuB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,wEAAwE;QACzE,CAAC;IACF,CAAC;CACD","file":"textAreaEditContextInput.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 browser from '../../../../../base/browser/browser.js';\nimport * as dom from '../../../../../base/browser/dom.js';\nimport { DomEmitter } from '../../../../../base/browser/event.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { inputLatency } from '../../../../../base/browser/performance.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { OperatingSystem } from '../../../../../base/common/platform.js';\nimport * as strings from '../../../../../base/common/strings.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { ILogService, LogLevel } from '../../../../../platform/log/common/log.js';\nimport { ClipboardDataToCopy, ClipboardEventUtils, ClipboardStoredMetadata, InMemoryClipboardMetadataManager } from '../clipboardUtils.js';\nimport { _debugComposition, ITextAreaWrapper, ITypeData, TextAreaState } from './textAreaEditContextState.js';\nimport { generateUuid } from '../../../../../base/common/uuid.js';\n\nexport namespace TextAreaSyntethicEvents {\n\texport const Tap = '-monaco-textarea-synthetic-tap';\n}\n\nexport interface ICompositionData {\n}\n\n\nexport interface IPasteData {\n\ttext: string;\n\tmetadata: ClipboardStoredMetadata | null;\n}\n\nexport interface ITextAreaInputHost {\n\tgetDataToCopy(): ClipboardDataToCopy;\n\tgetScreenReaderContent(): TextAreaState;\n\tdeduceModelPosition(viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position;\n}\n\nexport interface ICompositionStartEvent {\n\tdata: string;\n}\n\nexport interface ICompleteTextAreaWrapper extends ITextAreaWrapper {\n\treadonly onKeyDown: Event<KeyboardEvent>;\n\treadonly onKeyUp: Event<KeyboardEvent>;\n\treadonly onCompositionStart: Event<CompositionEvent>;\n\treadonly onCompositionUpdate: Event<CompositionEvent>;\n\treadonly onCompositionEnd: Event<CompositionEvent>;\n\treadonly onInput: Event<InputEvent>;\n\treadonly onCut: Event<ClipboardEvent>;\n\treadonly onCopy: Event<ClipboardEvent>;\n\treadonly onPaste: Event<ClipboardEvent>;\n\treadonly onFocus: Event<FocusEvent>;\n\treadonly onBlur: Event<FocusEvent>;\n\treadonly onSyntheticTap: Event<void>;\n\n\treadonly ownerDocument: Document;\n\n\tsetIgnoreSelectionChangeTime(reason: string): void;\n\tgetIgnoreSelectionChangeTime(): number;\n\tresetSelectionChangeTime(): void;\n\n\thasFocus(): boolean;\n}\n\nexport interface IBrowser {\n\tisAndroid: boolean;\n\tisFirefox: boolean;\n\tisChrome: boolean;\n\tisSafari: boolean;\n}\n\nclass CompositionContext {\n\n\tprivate _lastTypeTextLength: number;\n\n\tconstructor() {\n\t\tthis._lastTypeTextLength = 0;\n\t}\n\n\tpublic handleCompositionUpdate(text: string | null | undefined): ITypeData {\n\t\ttext = text || '';\n\t\tconst typeInput: ITypeData = {\n\t\t\ttext: text,\n\t\t\treplacePrevCharCnt: this._lastTypeTextLength,\n\t\t\treplaceNextCharCnt: 0,\n\t\t\tpositionDelta: 0\n\t\t};\n\t\tthis._lastTypeTextLength = text.length;\n\t\treturn typeInput;\n\t}\n}\n\n/**\n * Writes screen reader content to the textarea and is able to analyze its input events to generate:\n * - onCut\n * - onPaste\n * - onType\n *\n * Composition events are generated for presentation purposes (composition input is reflected in onType).\n */\nexport class TextAreaInput extends Disposable {\n\n\tprivate _onFocus = this._register(new Emitter<void>());\n\tpublic readonly onFocus: Event<void> = this._onFocus.event;\n\n\tprivate _onBlur = this._register(new Emitter<void>());\n\tpublic readonly onBlur: Event<void> = this._onBlur.event;\n\n\tprivate _onKeyDown = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;\n\n\tprivate _onKeyUp = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;\n\n\tprivate _onCut = this._register(new Emitter<void>());\n\tpublic readonly onCut: Event<void> = this._onCut.event;\n\n\tprivate _onPaste = this._register(new Emitter<IPasteData>());\n\tpublic readonly onPaste: Event<IPasteData> = this._onPaste.event;\n\n\tprivate _onType = this._register(new Emitter<ITypeData>());\n\tpublic readonly onType: Event<ITypeData> = this._onType.event;\n\n\tprivate _onCompositionStart = this._register(new Emitter<ICompositionStartEvent>());\n\tpublic readonly onCompositionStart: Event<ICompositionStartEvent> = this._onCompositionStart.event;\n\n\tprivate _onCompositionUpdate = this._register(new Emitter<ICompositionData>());\n\tpublic readonly onCompositionUpdate: Event<ICompositionData> = this._onCompositionUpdate.event;\n\n\tprivate _onCompositionEnd = this._register(new Emitter<void>());\n\tpublic readonly onCompositionEnd: Event<void> = this._onCompositionEnd.event;\n\n\tprivate _onSelectionChangeRequest = this._register(new Emitter<Selection>());\n\tpublic readonly onSelectionChangeRequest: Event<Selection> = this._onSelectionChangeRequest.event;\n\n\t// ---\n\n\tprivate readonly _asyncTriggerCut: RunOnceScheduler;\n\n\tprivate readonly _asyncFocusGainWriteScreenReaderContent: MutableDisposable<RunOnceScheduler> = this._register(new MutableDisposable());\n\n\tprivate _textAreaState: TextAreaState;\n\n\tpublic get textAreaState(): TextAreaState {\n\t\treturn this._textAreaState;\n\t}\n\n\tprivate _selectionChangeListener: IDisposable | null;\n\n\tprivate _hasFocus: boolean;\n\tprivate _currentComposition: CompositionContext | null;\n\n\tconstructor(\n\t\tprivate readonly _host: ITextAreaInputHost,\n\t\tprivate readonly _textArea: ICompleteTextAreaWrapper,\n\t\tprivate readonly _OS: OperatingSystem,\n\t\tprivate readonly _browser: IBrowser,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t\t@ILogService private readonly _logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));\n\t\tthis._textAreaState = TextAreaState.EMPTY;\n\t\tthis._selectionChangeListener = null;\n\t\tif (this._accessibilityService.isScreenReaderOptimized()) {\n\t\t\tthis.writeNativeTextAreaContent('ctor');\n\t\t}\n\t\tthis._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0));\n\t\t\t} else {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.clear();\n\t\t\t}\n\t\t}));\n\t\tthis._hasFocus = false;\n\t\tthis._currentComposition = null;\n\n\t\tlet lastKeyDown: IKeyboardEvent | null = null;\n\n\t\tthis._register(this._textArea.onKeyDown((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tif (e.keyCode === KeyCode.KEY_IN_COMPOSITION\n\t\t\t\t|| (this._currentComposition && e.keyCode === KeyCode.Backspace)) {\n\t\t\t\t// Stop propagation for keyDown events if the IME is processing key input\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\n\t\t\tif (e.equals(KeyCode.Escape)) {\n\t\t\t\t// Prevent default always for `Esc`, otherwise it will generate a keypress\n\t\t\t\t// See https://msdn.microsoft.com/en-us/library/ie/ms536939(v=vs.85).aspx\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\tlastKeyDown = e;\n\t\t\tthis._onKeyDown.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onKeyUp((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tthis._onKeyUp.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionStart((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionstart]`, e);\n\t\t\t}\n\n\t\t\tconst currentComposition = new CompositionContext();\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// simply reset the composition context\n\t\t\t\tthis._currentComposition = currentComposition;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = currentComposition;\n\n\t\t\tif (\n\t\t\t\tthis._OS === OperatingSystem.Macintosh\n\t\t\t\t&& lastKeyDown\n\t\t\t\t&& lastKeyDown.equals(KeyCode.KEY_IN_COMPOSITION)\n\t\t\t\t&& this._textAreaState.selectionStart === this._textAreaState.selectionEnd\n\t\t\t\t&& this._textAreaState.selectionStart > 0\n\t\t\t\t&& this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data\n\t\t\t\t&& (lastKeyDown.code === 'ArrowRight' || lastKeyDown.code === 'ArrowLeft')\n\t\t\t) {\n\t\t\t\t// Handling long press case on Chromium/Safari macOS + arrow key => pretend the character was selected\n\t\t\t\tif (_debugComposition) {\n\t\t\t\t\tconsole.log(`[compositionstart] Handling long press case on macOS + arrow key`, e);\n\t\t\t\t}\n\t\t\t\t// Pretend the previous character was composed (in order to get it removed by subsequent compositionupdate events)\n\t\t\t\tcurrentComposition.handleCompositionUpdate('x');\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// when tapping on the editor, Android enters composition mode to edit the current word\n\t\t\t\t// so we cannot clear the textarea on Android and we must pretend the current word was selected\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionUpdate((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionupdate]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// should not be possible to receive a 'compositionupdate' without a 'compositionstart'\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionEnd((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionend]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// https://github.com/microsoft/monaco-editor/issues/1663\n\t\t\t\t// On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = null;\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionEnd.fire();\n\t\t}));\n\n\t\tthis._register(this._textArea.onInput((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[input]`, e);\n\t\t\t}\n\n\t\t\t// Pretend here we touched the text area, as the `input` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received input event');\n\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tconst typeInput = TextAreaState.deduceInput(this._textAreaState, newState, /*couldBeEmojiInput*/this._OS === OperatingSystem.Macintosh);\n\n\t\t\tif (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1) {\n\t\t\t\t// one character was typed\n\t\t\t\tif (\n\t\t\t\t\tstrings.isHighSurrogate(typeInput.text.charCodeAt(0))\n\t\t\t\t\t|| typeInput.text.charCodeAt(0) === 0x7f /* Delete */\n\t\t\t\t) {\n\t\t\t\t\t// Ignore invalid input but keep it around for next time\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._textAreaState = newState;\n\t\t\tif (\n\t\t\t\ttypeInput.text !== ''\n\t\t\t\t|| typeInput.replacePrevCharCnt !== 0\n\t\t\t\t|| typeInput.replaceNextCharCnt !== 0\n\t\t\t\t|| typeInput.positionDelta !== 0\n\t\t\t) {\n\t\t\t\t// https://w3c.github.io/input-events/#interface-InputEvent-Attributes\n\t\t\t\tif (e.inputType === 'insertFromPaste') {\n\t\t\t\t\tthis._onPaste.fire({\n\t\t\t\t\t\ttext: typeInput.text,\n\t\t\t\t\t\tmetadata: InMemoryClipboardMetadataManager.INSTANCE.get(typeInput.text)\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\t// --- Clipboard operations\n\n\t\tthis._register(this._textArea.onCut((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCut`, e);\n\t\t\t// Pretend here we touched the text area, as the `cut` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received cut event');\n\n\t\t\tthis._ensureClipboardGetsEditorSelection(e);\n\t\t\tthis._asyncTriggerCut.schedule();\n\t\t}));\n\n\t\tthis._register(this._textArea.onCopy((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCopy`, e);\n\t\t\tthis._ensureClipboardGetsEditorSelection(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onPaste((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste`, e);\n\t\t\t// Pretend here we touched the text area, as the `paste` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received paste event');\n\n\t\t\te.preventDefault();\n\n\t\t\tif (!e.clipboardData) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste with id : `, metadata?.id, ' with text.length: ', text.length);\n\t\t\tif (!text) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// try the in-memory store\n\t\t\tmetadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);\n\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste (before onPaste)`);\n\t\t\tthis._onPaste.fire({\n\t\t\t\ttext: text,\n\t\t\t\tmetadata: metadata\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._textArea.onFocus(() => {\n\t\t\tconst hadFocus = this._hasFocus;\n\n\t\t\tthis._setHasFocus(true);\n\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {\n\t\t\t\t// When \"tabbing into\" the textarea, immediately after dispatching the 'focus' event,\n\t\t\t\t// Safari will always move the selection at offset 0 in the textarea\n\t\t\t\tif (!this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0);\n\t\t\t\t}\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value.schedule();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._textArea.onBlur(() => {\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// See https://github.com/microsoft/vscode/issues/112621\n\t\t\t\t// where compositionend is not triggered when the editor\n\t\t\t\t// is taken off-dom during a composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('blurWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t\tthis._setHasFocus(false);\n\t\t}));\n\t\tthis._register(this._textArea.onSyntheticTap(() => {\n\t\t\tif (this._browser.isAndroid && this._currentComposition) {\n\t\t\t\t// on Android, tapping does not cancel the current composition, so the\n\t\t\t\t// textarea is stuck showing the old composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('tapWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _installSelectionChangeListener(): IDisposable {\n\t\t// See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256\n\t\t// When using a Braille display, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event.\n\t\t//\n\t\t// The `selectionchange` event appears to be emitted under numerous other circumstances,\n\t\t// so it is quite a challenge to distinguish a `selectionchange` coming in from a user\n\t\t// using a Braille display from all the other cases.\n\t\t//\n\t\t// The problems with the `selectionchange` event are:\n\t\t// * the event is emitted when the textarea is focused programmatically -- textarea.focus()\n\t\t// * the event is emitted when the selection is changed in the textarea programmatically -- textarea.setSelectionRange(...)\n\t\t// * the event is emitted when the value of the textarea is changed programmatically -- textarea.value = '...'\n\t\t// * the event is emitted when tabbing into the textarea\n\t\t// * the event is emitted asynchronously (sometimes with a delay as high as a few tens of ms)\n\t\t// * the event sometimes comes in bursts for a single logical textarea operation\n\n\t\t// `selectionchange` events often come multiple times for a single logical change\n\t\t// so throttle multiple `selectionchange` events that burst in a short period of time.\n\t\tlet previousSelectionChangeEventTime = 0;\n\t\treturn dom.addDisposableListener(this._textArea.ownerDocument, 'selectionchange', (e) => {//todo\n\t\t\tinputLatency.onSelectionChange();\n\n\t\t\tif (!this._hasFocus) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._browser.isChrome) {\n\t\t\t\t// Support only for Chrome until testing happens on other browsers\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst now = Date.now();\n\n\t\t\tconst delta1 = now - previousSelectionChangeEventTime;\n\t\t\tpreviousSelectionChangeEventTime = now;\n\t\t\tif (delta1 < 5) {\n\t\t\t\t// received another `selectionchange` event within 5ms of the previous `selectionchange` event\n\t\t\t\t// => ignore it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst delta2 = now - this._textArea.getIgnoreSelectionChangeTime();\n\t\t\tthis._textArea.resetSelectionChangeTime();\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the textarea\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!this._textAreaState.selection) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newValue = this._textArea.getValue();\n\t\t\tif (this._textAreaState.value !== newValue) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newSelectionStart = this._textArea.getSelectionStart();\n\t\t\tconst newSelectionEnd = this._textArea.getSelectionEnd();\n\t\t\tif (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {\n\t\t\t\t// Nothing to do...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);\n\t\t\tconst newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0]!, _newSelectionStartPosition[1], _newSelectionStartPosition[2]);\n\n\t\t\tconst _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);\n\t\t\tconst newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0]!, _newSelectionEndPosition[1], _newSelectionEndPosition[2]);\n\n\t\t\tconst newSelection = new Selection(\n\t\t\t\tnewSelectionStartPosition.lineNumber, newSelectionStartPosition.column,\n\t\t\t\tnewSelectionEndPosition.lineNumber, newSelectionEndPosition.column\n\t\t\t);\n\n\t\t\tthis._onSelectionChangeRequest.fire(newSelection);\n\t\t});\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t}\n\n\tpublic focusTextArea(): void {\n\t\t// Setting this._hasFocus and writing the screen reader content\n\t\t// will result in a focus() and setSelectionRange() in the textarea\n\t\tthis._setHasFocus(true);\n\n\t\t// If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus\n\t\tthis.refreshFocusState();\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._hasFocus;\n\t}\n\n\tpublic refreshFocusState(): void {\n\t\tthis._setHasFocus(this._textArea.hasFocus());\n\t}\n\n\tprivate _setHasFocus(newHasFocus: boolean): void {\n\t\tif (this._hasFocus === newHasFocus) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._hasFocus = newHasFocus;\n\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t\tif (this._hasFocus) {\n\t\t\tthis._selectionChangeListener = this._installSelectionChangeListener();\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis.writeNativeTextAreaContent('focusgain');\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis._onFocus.fire();\n\t\t} else {\n\t\t\tthis._onBlur.fire();\n\t\t}\n\t}\n\n\tprivate _setAndWriteTextAreaState(reason: string, textAreaState: TextAreaState): void {\n\t\tif (!this._hasFocus) {\n\t\t\ttextAreaState = textAreaState.collapseSelection();\n\t\t}\n\t\tif (!textAreaState.isWrittenToTextArea(this._textArea, this._hasFocus)) {\n\t\t\tthis._logService.trace(`writeTextAreaState(reason: ${reason})`);\n\t\t}\n\t\ttextAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);\n\t\tthis._textAreaState = textAreaState;\n\t}\n\n\tpublic writeNativeTextAreaContent(reason: string): void {\n\t\tif ((!this._accessibilityService.isScreenReaderOptimized() && reason === 'render') || this._currentComposition) {\n\t\t\t// Do not write to the text on render unless a screen reader is being used #192278\n\t\t\t// Do not write to the text area when doing composition\n\t\t\treturn;\n\t\t}\n\t\tthis._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());\n\t}\n\n\tprivate _ensureClipboardGetsEditorSelection(e: ClipboardEvent): void {\n\t\tconst dataToCopy = this._host.getDataToCopy();\n\t\tlet id = undefined;\n\t\tif (this._logService.getLevel() === LogLevel.Trace) {\n\t\t\tid = generateUuid();\n\t\t}\n\t\tconst storedMetadata: ClipboardStoredMetadata = {\n\t\t\tversion: 1,\n\t\t\tid,\n\t\t\tisFromEmptySelection: dataToCopy.isFromEmptySelection,\n\t\t\tmulticursorText: dataToCopy.multicursorText,\n\t\t\tmode: dataToCopy.mode\n\t\t};\n\t\tInMemoryClipboardMetadataManager.INSTANCE.set(\n\t\t\t// When writing \"LINE\\r\\n\" to the clipboard and then pasting,\n\t\t\t// Firefox pastes \"LINE\\n\", so let's work around this quirk\n\t\t\t(this._browser.isFirefox ? dataToCopy.text.replace(/\\r\\n/g, '\\n') : dataToCopy.text),\n\t\t\tstoredMetadata\n\t\t);\n\n\t\te.preventDefault();\n\t\tif (e.clipboardData) {\n\t\t\tClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);\n\t\t}\n\t\tthis._logService.trace('TextAreaEditContextInput#_ensureClipboardGetsEditorSelection with id : ', id, ' with text.length: ', dataToCopy.text.length);\n\t}\n}\n\nexport class TextAreaWrapper extends Disposable implements ICompleteTextAreaWrapper {\n\n\tpublic readonly onKeyDown: Event<KeyboardEvent>;\n\tpublic readonly onKeyPress: Event<KeyboardEvent>;\n\tpublic readonly onKeyUp: Event<KeyboardEvent>;\n\tpublic readonly onCompositionStart: Event<CompositionEvent>;\n\tpublic readonly onCompositionUpdate: Event<CompositionEvent>;\n\tpublic readonly onCompositionEnd: Event<CompositionEvent>;\n\tpublic readonly onBeforeInput: Event<InputEvent>;\n\tpublic readonly onInput: Event<InputEvent>;\n\tpublic readonly onCut: Event<ClipboardEvent>;\n\tpublic readonly onCopy: Event<ClipboardEvent>;\n\tpublic readonly onPaste: Event<ClipboardEvent>;\n\tpublic readonly onFocus: Event<FocusEvent>;\n\tpublic readonly onBlur: Event<FocusEvent>; // = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\tpublic get ownerDocument(): Document {\n\t\treturn this._actual.ownerDocument;\n\t}\n\n\tprivate _onSyntheticTap = this._register(new Emitter<void>());\n\tpublic readonly onSyntheticTap: Event<void> = this._onSyntheticTap.event;\n\n\tprivate _ignoreSelectionChangeTime: number;\n\n\tconstructor(\n\t\tprivate readonly _actual: HTMLTextAreaElement\n\t) {\n\t\tsuper();\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t\tthis.onKeyDown = this._register(new DomEmitter(this._actual, 'keydown')).event;\n\t\tthis.onKeyPress = this._register(new DomEmitter(this._actual, 'keypress')).event;\n\t\tthis.onKeyUp = this._register(new DomEmitter(this._actual, 'keyup')).event;\n\t\tthis.onCompositionStart = this._register(new DomEmitter(this._actual, 'compositionstart')).event;\n\t\tthis.onCompositionUpdate = this._register(new DomEmitter(this._actual, 'compositionupdate')).event;\n\t\tthis.onCompositionEnd = this._register(new DomEmitter(this._actual, 'compositionend')).event;\n\t\tthis.onBeforeInput = this._register(new DomEmitter(this._actual, 'beforeinput')).event;\n\t\tthis.onInput = <Event<InputEvent>>this._register(new DomEmitter(this._actual, 'input')).event;\n\t\tthis.onCut = this._register(new DomEmitter(this._actual, 'cut')).event;\n\t\tthis.onCopy = this._register(new DomEmitter(this._actual, 'copy')).event;\n\t\tthis.onPaste = this._register(new DomEmitter(this._actual, 'paste')).event;\n\t\tthis.onFocus = this._register(new DomEmitter(this._actual, 'focus')).event;\n\t\tthis.onBlur = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\t\tthis._register(this.onKeyDown(() => inputLatency.onKeyDown()));\n\t\tthis._register(this.onBeforeInput(() => inputLatency.onBeforeInput()));\n\t\tthis._register(this.onInput(() => inputLatency.onInput()));\n\t\tthis._register(this.onKeyUp(() => inputLatency.onKeyUp()));\n\t\tthis._register(dom.addDisposableListener(this._actual, TextAreaSyntethicEvents.Tap, () => this._onSyntheticTap.fire()));\n\t}\n\n\tpublic hasFocus(): boolean {\n\t\tconst shadowRoot = dom.getShadowRoot(this._actual);\n\t\tif (shadowRoot) {\n\t\t\treturn shadowRoot.activeElement === this._actual;\n\t\t} else if (this._actual.isConnected) {\n\t\t\treturn dom.getActiveElement() === this._actual;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tpublic getIgnoreSelectionChangeTime(): number {\n\t\treturn this._ignoreSelectionChangeTime;\n\t}\n\n\tpublic resetSelectionChangeTime(): void {\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t}\n\n\tpublic getValue(): string {\n\t\t// console.log('current value: ' + this._textArea.value);\n\t\treturn this._actual.value;\n\t}\n\n\tpublic setValue(reason: string, value: string): void {\n\t\tconst textArea = this._actual;\n\t\tif (textArea.value === value) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\t\t// console.log('reason: ' + reason + ', current value: ' + textArea.value + ' => new value: ' + value);\n\t\tthis.setIgnoreSelectionChangeTime('setValue');\n\t\ttextArea.value = value;\n\t}\n\n\tpublic getSelectionStart(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionEnd : this._actual.selectionStart;\n\t}\n\n\tpublic getSelectionEnd(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionStart : this._actual.selectionEnd;\n\t}\n\n\tpublic setSelectionRange(reason: string, selectionStart: number, selectionEnd: number): void {\n\t\tconst textArea = this._actual;\n\n\t\tlet activeElement: Element | null = null;\n\t\tconst shadowRoot = dom.getShadowRoot(textArea);\n\t\tif (shadowRoot) {\n\t\t\tactiveElement = shadowRoot.activeElement;\n\t\t} else {\n\t\t\tactiveElement = dom.getActiveElement();\n\t\t}\n\t\tconst activeWindow = dom.getWindow(activeElement);\n\n\t\tconst currentIsFocused = (activeElement === textArea);\n\t\tconst currentSelectionStart = textArea.selectionStart;\n\t\tconst currentSelectionEnd = textArea.selectionEnd;\n\n\t\tif (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {\n\t\t\t// No change\n\t\t\t// Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// console.log('reason: ' + reason + ', setSelectionRange: ' + selectionStart + ' -> ' + selectionEnd);\n\n\t\tif (currentIsFocused) {\n\t\t\t// No need to focus, only need to change the selection range\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If the focus is outside the textarea, browsers will try really hard to reveal the textarea.\n\t\t// Here, we try to undo the browser's desperate reveal.\n\t\ttry {\n\t\t\tconst scrollState = dom.saveParentsScrollTop(textArea);\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.focus();\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tdom.restoreParentsScrollTop(textArea, scrollState);\n\t\t} catch (e) {\n\t\t\t// Sometimes IE throws when setting selection (e.g. textarea is off-DOM)\n\t\t}\n\t}\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 browser from '../../../../../base/browser/browser.js';\nimport * as dom from '../../../../../base/browser/dom.js';\nimport { DomEmitter } from '../../../../../base/browser/event.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { inputLatency } from '../../../../../base/browser/performance.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { OperatingSystem } from '../../../../../base/common/platform.js';\nimport * as strings from '../../../../../base/common/strings.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { ILogService, LogLevel } from '../../../../../platform/log/common/log.js';\nimport { ClipboardDataToCopy, ClipboardEventUtils, ClipboardStoredMetadata, InMemoryClipboardMetadataManager } from '../clipboardUtils.js';\nimport { _debugComposition, ITextAreaWrapper, ITypeData, TextAreaState } from './textAreaEditContextState.js';\nimport { generateUuid } from '../../../../../base/common/uuid.js';\n\nexport namespace TextAreaSyntethicEvents {\n\texport const Tap = '-monaco-textarea-synthetic-tap';\n}\n\nexport interface ICompositionData {\n}\n\n\nexport interface IPasteData {\n\ttext: string;\n\tmetadata: ClipboardStoredMetadata | null;\n}\n\nexport interface ITextAreaInputHost {\n\tgetDataToCopy(): ClipboardDataToCopy;\n\tgetScreenReaderContent(): TextAreaState;\n\tdeduceModelPosition(viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position;\n}\n\nexport interface ICompositionStartEvent {\n\tdata: string;\n}\n\nexport interface ICompleteTextAreaWrapper extends ITextAreaWrapper {\n\treadonly onKeyDown: Event<KeyboardEvent>;\n\treadonly onKeyUp: Event<KeyboardEvent>;\n\treadonly onCompositionStart: Event<CompositionEvent>;\n\treadonly onCompositionUpdate: Event<CompositionEvent>;\n\treadonly onCompositionEnd: Event<CompositionEvent>;\n\treadonly onInput: Event<InputEvent>;\n\treadonly onCut: Event<ClipboardEvent>;\n\treadonly onCopy: Event<ClipboardEvent>;\n\treadonly onPaste: Event<ClipboardEvent>;\n\treadonly onFocus: Event<FocusEvent>;\n\treadonly onBlur: Event<FocusEvent>;\n\treadonly onSyntheticTap: Event<void>;\n\n\treadonly ownerDocument: Document;\n\n\tsetIgnoreSelectionChangeTime(reason: string): void;\n\tgetIgnoreSelectionChangeTime(): number;\n\tresetSelectionChangeTime(): void;\n\n\thasFocus(): boolean;\n}\n\nexport interface IBrowser {\n\tisAndroid: boolean;\n\tisFirefox: boolean;\n\tisChrome: boolean;\n\tisSafari: boolean;\n}\n\nclass CompositionContext {\n\n\tprivate _lastTypeTextLength: number;\n\n\tconstructor() {\n\t\tthis._lastTypeTextLength = 0;\n\t}\n\n\tpublic handleCompositionUpdate(text: string | null | undefined): ITypeData {\n\t\ttext = text || '';\n\t\tconst typeInput: ITypeData = {\n\t\t\ttext: text,\n\t\t\treplacePrevCharCnt: this._lastTypeTextLength,\n\t\t\treplaceNextCharCnt: 0,\n\t\t\tpositionDelta: 0\n\t\t};\n\t\tthis._lastTypeTextLength = text.length;\n\t\treturn typeInput;\n\t}\n}\n\n/**\n * Writes screen reader content to the textarea and is able to analyze its input events to generate:\n * - onCut\n * - onPaste\n * - onType\n *\n * Composition events are generated for presentation purposes (composition input is reflected in onType).\n */\nexport class TextAreaInput extends Disposable {\n\n\tprivate _onFocus = this._register(new Emitter<void>());\n\tpublic readonly onFocus: Event<void> = this._onFocus.event;\n\n\tprivate _onBlur = this._register(new Emitter<void>());\n\tpublic readonly onBlur: Event<void> = this._onBlur.event;\n\n\tprivate _onKeyDown = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;\n\n\tprivate _onKeyUp = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;\n\n\tprivate _onCut = this._register(new Emitter<void>());\n\tpublic readonly onCut: Event<void> = this._onCut.event;\n\n\tprivate _onPaste = this._register(new Emitter<IPasteData>());\n\tpublic readonly onPaste: Event<IPasteData> = this._onPaste.event;\n\n\tprivate _onType = this._register(new Emitter<ITypeData>());\n\tpublic readonly onType: Event<ITypeData> = this._onType.event;\n\n\tprivate _onCompositionStart = this._register(new Emitter<ICompositionStartEvent>());\n\tpublic readonly onCompositionStart: Event<ICompositionStartEvent> = this._onCompositionStart.event;\n\n\tprivate _onCompositionUpdate = this._register(new Emitter<ICompositionData>());\n\tpublic readonly onCompositionUpdate: Event<ICompositionData> = this._onCompositionUpdate.event;\n\n\tprivate _onCompositionEnd = this._register(new Emitter<void>());\n\tpublic readonly onCompositionEnd: Event<void> = this._onCompositionEnd.event;\n\n\tprivate _onSelectionChangeRequest = this._register(new Emitter<Selection>());\n\tpublic readonly onSelectionChangeRequest: Event<Selection> = this._onSelectionChangeRequest.event;\n\n\t// ---\n\n\tprivate readonly _asyncTriggerCut: RunOnceScheduler;\n\n\tprivate readonly _asyncFocusGainWriteScreenReaderContent: MutableDisposable<RunOnceScheduler> = this._register(new MutableDisposable());\n\n\tprivate _textAreaState: TextAreaState;\n\n\tpublic get textAreaState(): TextAreaState {\n\t\treturn this._textAreaState;\n\t}\n\n\tprivate _selectionChangeListener: IDisposable | null;\n\n\tprivate _hasFocus: boolean;\n\tprivate _currentComposition: CompositionContext | null;\n\n\tconstructor(\n\t\tprivate readonly _host: ITextAreaInputHost,\n\t\tprivate readonly _textArea: ICompleteTextAreaWrapper,\n\t\tprivate readonly _OS: OperatingSystem,\n\t\tprivate readonly _browser: IBrowser,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t\t@ILogService private readonly _logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));\n\t\tthis._textAreaState = TextAreaState.EMPTY;\n\t\tthis._selectionChangeListener = null;\n\t\tif (this._accessibilityService.isScreenReaderOptimized()) {\n\t\t\tthis.writeNativeTextAreaContent('ctor');\n\t\t}\n\t\tthis._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0));\n\t\t\t} else {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.clear();\n\t\t\t}\n\t\t}));\n\t\tthis._hasFocus = false;\n\t\tthis._currentComposition = null;\n\n\t\tlet lastKeyDown: IKeyboardEvent | null = null;\n\n\t\tthis._register(this._textArea.onKeyDown((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tif (e.keyCode === KeyCode.KEY_IN_COMPOSITION\n\t\t\t\t|| (this._currentComposition && e.keyCode === KeyCode.Backspace)) {\n\t\t\t\t// Stop propagation for keyDown events if the IME is processing key input\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\n\t\t\tif (e.equals(KeyCode.Escape)) {\n\t\t\t\t// Prevent default always for `Esc`, otherwise it will generate a keypress\n\t\t\t\t// See https://msdn.microsoft.com/en-us/library/ie/ms536939(v=vs.85).aspx\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\tlastKeyDown = e;\n\t\t\tthis._onKeyDown.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onKeyUp((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tthis._onKeyUp.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionStart((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionstart]`, e);\n\t\t\t}\n\n\t\t\tconst currentComposition = new CompositionContext();\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// simply reset the composition context\n\t\t\t\tthis._currentComposition = currentComposition;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = currentComposition;\n\n\t\t\tif (\n\t\t\t\tthis._OS === OperatingSystem.Macintosh\n\t\t\t\t&& lastKeyDown\n\t\t\t\t&& lastKeyDown.equals(KeyCode.KEY_IN_COMPOSITION)\n\t\t\t\t&& this._textAreaState.selectionStart === this._textAreaState.selectionEnd\n\t\t\t\t&& this._textAreaState.selectionStart > 0\n\t\t\t\t&& this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data\n\t\t\t\t&& (lastKeyDown.code === 'ArrowRight' || lastKeyDown.code === 'ArrowLeft')\n\t\t\t) {\n\t\t\t\t// Handling long press case on Chromium/Safari macOS + arrow key => pretend the character was selected\n\t\t\t\tif (_debugComposition) {\n\t\t\t\t\tconsole.log(`[compositionstart] Handling long press case on macOS + arrow key`, e);\n\t\t\t\t}\n\t\t\t\t// Pretend the previous character was composed (in order to get it removed by subsequent compositionupdate events)\n\t\t\t\tcurrentComposition.handleCompositionUpdate('x');\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// when tapping on the editor, Android enters composition mode to edit the current word\n\t\t\t\t// so we cannot clear the textarea on Android and we must pretend the current word was selected\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionUpdate((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionupdate]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// should not be possible to receive a 'compositionupdate' without a 'compositionstart'\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionEnd((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionend]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// https://github.com/microsoft/monaco-editor/issues/1663\n\t\t\t\t// On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = null;\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionEnd.fire();\n\t\t}));\n\n\t\tthis._register(this._textArea.onInput((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[input]`, e);\n\t\t\t}\n\n\t\t\t// Pretend here we touched the text area, as the `input` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received input event');\n\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tconst typeInput = TextAreaState.deduceInput(this._textAreaState, newState, /*couldBeEmojiInput*/this._OS === OperatingSystem.Macintosh);\n\n\t\t\tif (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1) {\n\t\t\t\t// one character was typed\n\t\t\t\tif (\n\t\t\t\t\tstrings.isHighSurrogate(typeInput.text.charCodeAt(0))\n\t\t\t\t\t|| typeInput.text.charCodeAt(0) === 0x7f /* Delete */\n\t\t\t\t) {\n\t\t\t\t\t// Ignore invalid input but keep it around for next time\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._textAreaState = newState;\n\t\t\tif (\n\t\t\t\ttypeInput.text !== ''\n\t\t\t\t|| typeInput.replacePrevCharCnt !== 0\n\t\t\t\t|| typeInput.replaceNextCharCnt !== 0\n\t\t\t\t|| typeInput.positionDelta !== 0\n\t\t\t) {\n\t\t\t\t// https://w3c.github.io/input-events/#interface-InputEvent-Attributes\n\t\t\t\tif (e.inputType === 'insertFromPaste') {\n\t\t\t\t\tthis._onPaste.fire({\n\t\t\t\t\t\ttext: typeInput.text,\n\t\t\t\t\t\tmetadata: InMemoryClipboardMetadataManager.INSTANCE.get(typeInput.text)\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\t// --- Clipboard operations\n\n\t\tthis._register(this._textArea.onCut((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCut`, e);\n\t\t\t// Pretend here we touched the text area, as the `cut` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received cut event');\n\n\t\t\tthis._ensureClipboardGetsEditorSelection(e);\n\t\t\tthis._asyncTriggerCut.schedule();\n\t\t}));\n\n\t\tthis._register(this._textArea.onCopy((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCopy`, e);\n\t\t\tthis._ensureClipboardGetsEditorSelection(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onPaste((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste`, e);\n\t\t\t// Pretend here we touched the text area, as the `paste` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received paste event');\n\n\t\t\te.preventDefault();\n\n\t\t\tif (!e.clipboardData) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste with id : `, metadata?.id, ' with text.length: ', text.length);\n\t\t\tif (!text) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// try the in-memory store\n\t\t\tmetadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);\n\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste (before onPaste)`);\n\t\t\tthis._onPaste.fire({\n\t\t\t\ttext: text,\n\t\t\t\tmetadata: metadata\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._textArea.onFocus(() => {\n\t\t\tconst hadFocus = this._hasFocus;\n\n\t\t\tthis._setHasFocus(true);\n\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {\n\t\t\t\t// When \"tabbing into\" the textarea, immediately after dispatching the 'focus' event,\n\t\t\t\t// Safari will always move the selection at offset 0 in the textarea\n\t\t\t\tif (!this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0);\n\t\t\t\t}\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value.schedule();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._textArea.onBlur(() => {\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// See https://github.com/microsoft/vscode/issues/112621\n\t\t\t\t// where compositionend is not triggered when the editor\n\t\t\t\t// is taken off-dom during a composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('blurWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t\tthis._setHasFocus(false);\n\t\t}));\n\t\tthis._register(this._textArea.onSyntheticTap(() => {\n\t\t\tif (this._browser.isAndroid && this._currentComposition) {\n\t\t\t\t// on Android, tapping does not cancel the current composition, so the\n\t\t\t\t// textarea is stuck showing the old composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('tapWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _installSelectionChangeListener(): IDisposable {\n\t\t// See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256\n\t\t// When using a Braille display, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event.\n\t\t//\n\t\t// The `selectionchange` event appears to be emitted under numerous other circumstances,\n\t\t// so it is quite a challenge to distinguish a `selectionchange` coming in from a user\n\t\t// using a Braille display from all the other cases.\n\t\t//\n\t\t// The problems with the `selectionchange` event are:\n\t\t// * the event is emitted when the textarea is focused programmatically -- textarea.focus()\n\t\t// * the event is emitted when the selection is changed in the textarea programmatically -- textarea.setSelectionRange(...)\n\t\t// * the event is emitted when the value of the textarea is changed programmatically -- textarea.value = '...'\n\t\t// * the event is emitted when tabbing into the textarea\n\t\t// * the event is emitted asynchronously (sometimes with a delay as high as a few tens of ms)\n\t\t// * the event sometimes comes in bursts for a single logical textarea operation\n\n\t\t// `selectionchange` events often come multiple times for a single logical change\n\t\t// so throttle multiple `selectionchange` events that burst in a short period of time.\n\t\tlet previousSelectionChangeEventTime = 0;\n\t\treturn dom.addDisposableListener(this._textArea.ownerDocument, 'selectionchange', (e) => {//todo\n\t\t\tinputLatency.onSelectionChange();\n\n\t\t\tif (!this._hasFocus) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._browser.isChrome) {\n\t\t\t\t// Support only for Chrome until testing happens on other browsers\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst now = Date.now();\n\n\t\t\tconst delta1 = now - previousSelectionChangeEventTime;\n\t\t\tpreviousSelectionChangeEventTime = now;\n\t\t\tif (delta1 < 5) {\n\t\t\t\t// received another `selectionchange` event within 5ms of the previous `selectionchange` event\n\t\t\t\t// => ignore it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst delta2 = now - this._textArea.getIgnoreSelectionChangeTime();\n\t\t\tthis._textArea.resetSelectionChangeTime();\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the textarea\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!this._textAreaState.selection) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newValue = this._textArea.getValue();\n\t\t\tif (this._textAreaState.value !== newValue) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newSelectionStart = this._textArea.getSelectionStart();\n\t\t\tconst newSelectionEnd = this._textArea.getSelectionEnd();\n\t\t\tif (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {\n\t\t\t\t// Nothing to do...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);\n\t\t\tconst newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0]!, _newSelectionStartPosition[1], _newSelectionStartPosition[2]);\n\n\t\t\tconst _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);\n\t\t\tconst newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0]!, _newSelectionEndPosition[1], _newSelectionEndPosition[2]);\n\n\t\t\tconst newSelection = new Selection(\n\t\t\t\tnewSelectionStartPosition.lineNumber, newSelectionStartPosition.column,\n\t\t\t\tnewSelectionEndPosition.lineNumber, newSelectionEndPosition.column\n\t\t\t);\n\n\t\t\tthis._onSelectionChangeRequest.fire(newSelection);\n\t\t});\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t}\n\n\tpublic focusTextArea(): void {\n\t\t// Setting this._hasFocus and writing the screen reader content\n\t\t// will result in a focus() and setSelectionRange() in the textarea\n\t\tthis._setHasFocus(true);\n\n\t\t// If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus\n\t\tthis.refreshFocusState();\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._hasFocus;\n\t}\n\n\tpublic refreshFocusState(): void {\n\t\tthis._setHasFocus(this._textArea.hasFocus());\n\t}\n\n\tprivate _setHasFocus(newHasFocus: boolean): void {\n\t\tif (this._hasFocus === newHasFocus) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._hasFocus = newHasFocus;\n\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t\tif (this._hasFocus) {\n\t\t\tthis._selectionChangeListener = this._installSelectionChangeListener();\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis.writeNativeTextAreaContent('focusgain');\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis._onFocus.fire();\n\t\t} else {\n\t\t\tthis._onBlur.fire();\n\t\t}\n\t}\n\n\tprivate _setAndWriteTextAreaState(reason: string, textAreaState: TextAreaState): void {\n\t\tif (!this._hasFocus) {\n\t\t\ttextAreaState = textAreaState.collapseSelection();\n\t\t}\n\t\tif (!textAreaState.isWrittenToTextArea(this._textArea, this._hasFocus)) {\n\t\t\tthis._logService.trace(`writeTextAreaState(reason: ${reason})`);\n\t\t}\n\t\ttextAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);\n\t\tthis._textAreaState = textAreaState;\n\t}\n\n\tpublic writeNativeTextAreaContent(reason: string): void {\n\t\tif ((!this._accessibilityService.isScreenReaderOptimized() && reason === 'render') || this._currentComposition) {\n\t\t\t// Do not write to the text on render unless a screen reader is being used #192278\n\t\t\t// Do not write to the text area when doing composition\n\t\t\treturn;\n\t\t}\n\t\tthis._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());\n\t}\n\n\tprivate _ensureClipboardGetsEditorSelection(e: ClipboardEvent): void {\n\t\tconst dataToCopy = this._host.getDataToCopy();\n\t\tlet id = undefined;\n\t\tif (this._logService.getLevel() === LogLevel.Trace) {\n\t\t\tid = generateUuid();\n\t\t}\n\t\tconst storedMetadata: ClipboardStoredMetadata = {\n\t\t\tversion: 1,\n\t\t\tid,\n\t\t\tisFromEmptySelection: dataToCopy.isFromEmptySelection,\n\t\t\tmulticursorText: dataToCopy.multicursorText,\n\t\t\tmode: dataToCopy.mode\n\t\t};\n\t\tInMemoryClipboardMetadataManager.INSTANCE.set(\n\t\t\t// When writing \"LINE\\r\\n\" to the clipboard and then pasting,\n\t\t\t// Firefox pastes \"LINE\\n\", so let's work around this quirk\n\t\t\t(this._browser.isFirefox ? dataToCopy.text.replace(/\\r\\n/g, '\\n') : dataToCopy.text),\n\t\t\tstoredMetadata\n\t\t);\n\n\t\te.preventDefault();\n\t\tif (e.clipboardData) {\n\t\t\tClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);\n\t\t}\n\t\tthis._logService.trace('TextAreaEditContextInput#_ensureClipboardGetsEditorSelection with id : ', id, ' with text.length: ', dataToCopy.text.length);\n\t}\n}\n\nexport class TextAreaWrapper extends Disposable implements ICompleteTextAreaWrapper {\n\n\tpublic readonly onKeyDown: Event<KeyboardEvent>;\n\tpublic readonly onKeyPress: Event<KeyboardEvent>;\n\tpublic readonly onKeyUp: Event<KeyboardEvent>;\n\tpublic readonly onCompositionStart: Event<CompositionEvent>;\n\tpublic readonly onCompositionUpdate: Event<CompositionEvent>;\n\tpublic readonly onCompositionEnd: Event<CompositionEvent>;\n\tpublic readonly onBeforeInput: Event<InputEvent>;\n\tpublic readonly onInput: Event<InputEvent>;\n\tpublic readonly onCut: Event<ClipboardEvent>;\n\tpublic readonly onCopy: Event<ClipboardEvent>;\n\tpublic readonly onPaste: Event<ClipboardEvent>;\n\tpublic readonly onFocus: Event<FocusEvent>;\n\tpublic readonly onBlur: Event<FocusEvent>; // = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\tpublic get ownerDocument(): Document {\n\t\treturn this._actual.ownerDocument;\n\t}\n\n\tprivate _onSyntheticTap = this._register(new Emitter<void>());\n\tpublic readonly onSyntheticTap: Event<void> = this._onSyntheticTap.event;\n\n\tprivate _ignoreSelectionChangeTime: number;\n\n\tconstructor(\n\t\tprivate readonly _actual: HTMLTextAreaElement\n\t) {\n\t\tsuper();\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t\tthis.onKeyDown = this._register(new DomEmitter(this._actual, 'keydown')).event;\n\t\tthis.onKeyPress = this._register(new DomEmitter(this._actual, 'keypress')).event;\n\t\tthis.onKeyUp = this._register(new DomEmitter(this._actual, 'keyup')).event;\n\t\tthis.onCompositionStart = this._register(new DomEmitter(this._actual, 'compositionstart')).event;\n\t\tthis.onCompositionUpdate = this._register(new DomEmitter(this._actual, 'compositionupdate')).event;\n\t\tthis.onCompositionEnd = this._register(new DomEmitter(this._actual, 'compositionend')).event;\n\t\tthis.onBeforeInput = this._register(new DomEmitter(this._actual, 'beforeinput')).event;\n\t\tthis.onInput = <Event<InputEvent>>this._register(new DomEmitter(this._actual, 'input')).event;\n\t\tthis.onCut = this._register(new DomEmitter(this._actual, 'cut')).event;\n\t\tthis.onCopy = this._register(new DomEmitter(this._actual, 'copy')).event;\n\t\tthis.onPaste = this._register(new DomEmitter(this._actual, 'paste')).event;\n\t\tthis.onFocus = this._register(new DomEmitter(this._actual, 'focus')).event;\n\t\tthis.onBlur = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\t\tthis._register(this.onKeyDown(() => inputLatency.onKeyDown()));\n\t\tthis._register(this.onBeforeInput(() => inputLatency.onBeforeInput()));\n\t\tthis._register(this.onInput(() => inputLatency.onInput()));\n\t\tthis._register(this.onKeyUp(() => inputLatency.onKeyUp()));\n\t\tthis._register(dom.addDisposableListener(this._actual, TextAreaSyntethicEvents.Tap, () => this._onSyntheticTap.fire()));\n\t}\n\n\tpublic hasFocus(): boolean {\n\t\tconst shadowRoot = dom.getShadowRoot(this._actual);\n\t\tif (shadowRoot) {\n\t\t\treturn shadowRoot.activeElement === this._actual;\n\t\t} else if (this._actual.isConnected) {\n\t\t\treturn dom.getActiveElement() === this._actual;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tpublic getIgnoreSelectionChangeTime(): number {\n\t\treturn this._ignoreSelectionChangeTime;\n\t}\n\n\tpublic resetSelectionChangeTime(): void {\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t}\n\n\tpublic getValue(): string {\n\t\t// console.log('current value: ' + this._textArea.value);\n\t\treturn this._actual.value;\n\t}\n\n\tpublic setValue(reason: string, value: string): void {\n\t\tconst textArea = this._actual;\n\t\tif (textArea.value === value) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\t\t// console.log('reason: ' + reason + ', current value: ' + textArea.value + ' => new value: ' + value);\n\t\tthis.setIgnoreSelectionChangeTime('setValue');\n\t\ttextArea.value = value;\n\t}\n\n\tpublic getSelectionStart(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionEnd : this._actual.selectionStart;\n\t}\n\n\tpublic getSelectionEnd(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionStart : this._actual.selectionEnd;\n\t}\n\n\tpublic setSelectionRange(reason: string, selectionStart: number, selectionEnd: number): void {\n\t\tconst textArea = this._actual;\n\n\t\tlet activeElement: Element | null = null;\n\t\tconst shadowRoot = dom.getShadowRoot(textArea);\n\t\tif (shadowRoot) {\n\t\t\tactiveElement = shadowRoot.activeElement;\n\t\t} else {\n\t\t\tactiveElement = dom.getActiveElement();\n\t\t}\n\t\tconst activeWindow = dom.getWindow(activeElement);\n\n\t\tconst currentIsFocused = (activeElement === textArea);\n\t\tconst currentSelectionStart = textArea.selectionStart;\n\t\tconst currentSelectionEnd = textArea.selectionEnd;\n\n\t\tif (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {\n\t\t\t// No change\n\t\t\t// Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// console.log('reason: ' + reason + ', setSelectionRange: ' + selectionStart + ' -> ' + selectionEnd);\n\n\t\tif (currentIsFocused) {\n\t\t\t// No need to focus, only need to change the selection range\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If the focus is outside the textarea, browsers will try really hard to reveal the textarea.\n\t\t// Here, we try to undo the browser's desperate reveal.\n\t\ttry {\n\t\t\tconst scrollState = dom.saveParentsScrollTop(textArea);\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.focus();\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tdom.restoreParentsScrollTop(textArea, scrollState);\n\t\t} catch (e) {\n\t\t\t// Sometimes IE throws when setting selection (e.g. textarea is off-DOM)\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.ts","vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,KAAK,OAAO,MAAM,wCAAwC,CAAC;AAClE,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAkB,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAErG,OAAO,KAAK,OAAO,MAAM,uCAAuC,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC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AM,KAAK,YAAY,EAAE,CAAC;gBAC/D,QAAQ,CAAC,KAAK,EAAE,CAAC;YAClB,CAAC;YACD,OAAO;QACR,CAAC;QAED,8FAA8F;QAC9F,uDAAuD;QACvD,IAAI,CAAC;YACJ,MAAM,WAAW,GAAG,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YACvD,IAAI,CAAC,4BAA4B,CAAC,mBAAmB,CAAC,CAAC;YACvD,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,QAAQ,CAAC,iBAAiB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YACzD,GAAG,CAAC,uBAAuB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,wEAAwE;QACzE,CAAC;IACF,CAAC;CACD","file":"textAreaEditContextInput.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 browser from '../../../../../base/browser/browser.js';\nimport * as dom from '../../../../../base/browser/dom.js';\nimport { DomEmitter } from '../../../../../base/browser/event.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { inputLatency } from '../../../../../base/browser/performance.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { OperatingSystem } from '../../../../../base/common/platform.js';\nimport * as strings from '../../../../../base/common/strings.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { ensureClipboardGetsEditorSelection, computePasteData, InMemoryClipboardMetadataManager, IPasteData, getPasteDataFromMetadata } from '../clipboardUtils.js';\nimport { _debugComposition, ITextAreaWrapper, ITypeData, TextAreaState } from './textAreaEditContextState.js';\nimport { ViewContext } from '../../../../common/viewModel/viewContext.js';\n\nexport namespace TextAreaSyntethicEvents {\n\texport const Tap = '-monaco-textarea-synthetic-tap';\n}\n\nexport interface ICompositionData {\n}\n\nexport interface ITextAreaInputHost {\n\treadonly context: ViewContext | null;\n\tgetScreenReaderContent(): TextAreaState;\n\tdeduceModelPosition(viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position;\n}\n\nexport interface ICompositionStartEvent {\n\tdata: string;\n}\n\nexport interface ICompleteTextAreaWrapper extends ITextAreaWrapper {\n\treadonly onKeyDown: Event<KeyboardEvent>;\n\treadonly onKeyUp: Event<KeyboardEvent>;\n\treadonly onCompositionStart: Event<CompositionEvent>;\n\treadonly onCompositionUpdate: Event<CompositionEvent>;\n\treadonly onCompositionEnd: Event<CompositionEvent>;\n\treadonly onInput: Event<InputEvent>;\n\treadonly onCut: Event<ClipboardEvent>;\n\treadonly onCopy: Event<ClipboardEvent>;\n\treadonly onPaste: Event<ClipboardEvent>;\n\treadonly onFocus: Event<FocusEvent>;\n\treadonly onBlur: Event<FocusEvent>;\n\treadonly onSyntheticTap: Event<void>;\n\n\treadonly ownerDocument: Document;\n\n\tsetIgnoreSelectionChangeTime(reason: string): void;\n\tgetIgnoreSelectionChangeTime(): number;\n\tresetSelectionChangeTime(): void;\n\n\thasFocus(): boolean;\n}\n\nexport interface IBrowser {\n\tisAndroid: boolean;\n\tisFirefox: boolean;\n\tisChrome: boolean;\n\tisSafari: boolean;\n}\n\nclass CompositionContext {\n\n\tprivate _lastTypeTextLength: number;\n\n\tconstructor() {\n\t\tthis._lastTypeTextLength = 0;\n\t}\n\n\tpublic handleCompositionUpdate(text: string | null | undefined): ITypeData {\n\t\ttext = text || '';\n\t\tconst typeInput: ITypeData = {\n\t\t\ttext: text,\n\t\t\treplacePrevCharCnt: this._lastTypeTextLength,\n\t\t\treplaceNextCharCnt: 0,\n\t\t\tpositionDelta: 0\n\t\t};\n\t\tthis._lastTypeTextLength = text.length;\n\t\treturn typeInput;\n\t}\n}\n\n/**\n * Writes screen reader content to the textarea and is able to analyze its input events to generate:\n * - onCut\n * - onPaste\n * - onType\n *\n * Composition events are generated for presentation purposes (composition input is reflected in onType).\n */\nexport class TextAreaInput extends Disposable {\n\n\tprivate _onFocus = this._register(new Emitter<void>());\n\tpublic readonly onFocus: Event<void> = this._onFocus.event;\n\n\tprivate _onBlur = this._register(new Emitter<void>());\n\tpublic readonly onBlur: Event<void> = this._onBlur.event;\n\n\tprivate _onKeyDown = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;\n\n\tprivate _onKeyUp = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;\n\n\tprivate _onCut = this._register(new Emitter<void>());\n\tpublic readonly onCut: Event<void> = this._onCut.event;\n\n\tprivate _onPaste = this._register(new Emitter<IPasteData>());\n\tpublic readonly onPaste: Event<IPasteData> = this._onPaste.event;\n\n\tprivate _onType = this._register(new Emitter<ITypeData>());\n\tpublic readonly onType: Event<ITypeData> = this._onType.event;\n\n\tprivate _onCompositionStart = this._register(new Emitter<ICompositionStartEvent>());\n\tpublic readonly onCompositionStart: Event<ICompositionStartEvent> = this._onCompositionStart.event;\n\n\tprivate _onCompositionUpdate = this._register(new Emitter<ICompositionData>());\n\tpublic readonly onCompositionUpdate: Event<ICompositionData> = this._onCompositionUpdate.event;\n\n\tprivate _onCompositionEnd = this._register(new Emitter<void>());\n\tpublic readonly onCompositionEnd: Event<void> = this._onCompositionEnd.event;\n\n\tprivate _onSelectionChangeRequest = this._register(new Emitter<Selection>());\n\tpublic readonly onSelectionChangeRequest: Event<Selection> = this._onSelectionChangeRequest.event;\n\n\t// ---\n\n\tprivate readonly _asyncTriggerCut: RunOnceScheduler;\n\n\tprivate readonly _asyncFocusGainWriteScreenReaderContent: MutableDisposable<RunOnceScheduler> = this._register(new MutableDisposable());\n\n\tprivate _textAreaState: TextAreaState;\n\n\tpublic get textAreaState(): TextAreaState {\n\t\treturn this._textAreaState;\n\t}\n\n\tprivate _selectionChangeListener: IDisposable | null;\n\n\tprivate _hasFocus: boolean;\n\tprivate _currentComposition: CompositionContext | null;\n\n\tconstructor(\n\t\tprivate readonly _host: ITextAreaInputHost,\n\t\tprivate readonly _textArea: ICompleteTextAreaWrapper,\n\t\tprivate readonly _OS: OperatingSystem,\n\t\tprivate readonly _browser: IBrowser,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t\t@ILogService private readonly _logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));\n\t\tthis._textAreaState = TextAreaState.EMPTY;\n\t\tthis._selectionChangeListener = null;\n\t\tif (this._accessibilityService.isScreenReaderOptimized()) {\n\t\t\tthis.writeNativeTextAreaContent('ctor');\n\t\t}\n\t\tthis._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0));\n\t\t\t} else {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.clear();\n\t\t\t}\n\t\t}));\n\t\tthis._hasFocus = false;\n\t\tthis._currentComposition = null;\n\n\t\tlet lastKeyDown: IKeyboardEvent | null = null;\n\n\t\tthis._register(this._textArea.onKeyDown((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tif (e.keyCode === KeyCode.KEY_IN_COMPOSITION\n\t\t\t\t|| (this._currentComposition && e.keyCode === KeyCode.Backspace)) {\n\t\t\t\t// Stop propagation for keyDown events if the IME is processing key input\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\n\t\t\tif (e.equals(KeyCode.Escape)) {\n\t\t\t\t// Prevent default always for `Esc`, otherwise it will generate a keypress\n\t\t\t\t// See https://msdn.microsoft.com/en-us/library/ie/ms536939(v=vs.85).aspx\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\tlastKeyDown = e;\n\t\t\tthis._onKeyDown.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onKeyUp((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tthis._onKeyUp.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionStart((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionstart]`, e);\n\t\t\t}\n\n\t\t\tconst currentComposition = new CompositionContext();\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// simply reset the composition context\n\t\t\t\tthis._currentComposition = currentComposition;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = currentComposition;\n\n\t\t\tif (\n\t\t\t\tthis._OS === OperatingSystem.Macintosh\n\t\t\t\t&& lastKeyDown\n\t\t\t\t&& lastKeyDown.equals(KeyCode.KEY_IN_COMPOSITION)\n\t\t\t\t&& this._textAreaState.selectionStart === this._textAreaState.selectionEnd\n\t\t\t\t&& this._textAreaState.selectionStart > 0\n\t\t\t\t&& this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data\n\t\t\t\t&& (lastKeyDown.code === 'ArrowRight' || lastKeyDown.code === 'ArrowLeft')\n\t\t\t) {\n\t\t\t\t// Handling long press case on Chromium/Safari macOS + arrow key => pretend the character was selected\n\t\t\t\tif (_debugComposition) {\n\t\t\t\t\tconsole.log(`[compositionstart] Handling long press case on macOS + arrow key`, e);\n\t\t\t\t}\n\t\t\t\t// Pretend the previous character was composed (in order to get it removed by subsequent compositionupdate events)\n\t\t\t\tcurrentComposition.handleCompositionUpdate('x');\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// when tapping on the editor, Android enters composition mode to edit the current word\n\t\t\t\t// so we cannot clear the textarea on Android and we must pretend the current word was selected\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionUpdate((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionupdate]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// should not be possible to receive a 'compositionupdate' without a 'compositionstart'\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionEnd((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionend]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// https://github.com/microsoft/monaco-editor/issues/1663\n\t\t\t\t// On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = null;\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionEnd.fire();\n\t\t}));\n\n\t\tthis._register(this._textArea.onInput((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[input]`, e);\n\t\t\t}\n\n\t\t\t// Pretend here we touched the text area, as the `input` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received input event');\n\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tconst typeInput = TextAreaState.deduceInput(this._textAreaState, newState, /*couldBeEmojiInput*/this._OS === OperatingSystem.Macintosh);\n\n\t\t\tif (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1) {\n\t\t\t\t// one character was typed\n\t\t\t\tif (\n\t\t\t\t\tstrings.isHighSurrogate(typeInput.text.charCodeAt(0))\n\t\t\t\t\t|| typeInput.text.charCodeAt(0) === 0x7f /* Delete */\n\t\t\t\t) {\n\t\t\t\t\t// Ignore invalid input but keep it around for next time\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._textAreaState = newState;\n\t\t\tif (\n\t\t\t\ttypeInput.text !== ''\n\t\t\t\t|| typeInput.replacePrevCharCnt !== 0\n\t\t\t\t|| typeInput.replaceNextCharCnt !== 0\n\t\t\t\t|| typeInput.positionDelta !== 0\n\t\t\t) {\n\t\t\t\t// https://w3c.github.io/input-events/#interface-InputEvent-Attributes\n\t\t\t\tif (this._host.context && e.inputType === 'insertFromPaste') {\n\t\t\t\t\tthis._onPaste.fire(getPasteDataFromMetadata(\n\t\t\t\t\t\ttypeInput.text,\n\t\t\t\t\t\tInMemoryClipboardMetadataManager.INSTANCE.get(typeInput.text),\n\t\t\t\t\t\tthis._host.context\n\t\t\t\t\t));\n\t\t\t\t} else {\n\t\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\t// --- Clipboard operations\n\n\t\tthis._register(this._textArea.onCut((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCut`, e);\n\t\t\t// Pretend here we touched the text area, as the `cut` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received cut event');\n\n\t\t\tif (this._host.context) {\n\t\t\t\tensureClipboardGetsEditorSelection(e, this._host.context, this._logService, this._browser.isFirefox);\n\t\t\t}\n\t\t\tthis._asyncTriggerCut.schedule();\n\t\t}));\n\n\t\tthis._register(this._textArea.onCopy((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCopy`, e);\n\t\t\tif (this._host.context) {\n\t\t\t\tensureClipboardGetsEditorSelection(e, this._host.context, this._logService, this._browser.isFirefox);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this._textArea.onPaste((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste`, e);\n\t\t\t// Pretend here we touched the text area, as the `paste` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received paste event');\n\t\t\tif (!this._host.context) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst pasteData = computePasteData(e, this._host.context, this._logService);\n\t\t\tif (!pasteData) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste (before onPaste)`);\n\t\t\tthis._onPaste.fire(pasteData);\n\t\t}));\n\n\t\tthis._register(this._textArea.onFocus(() => {\n\t\t\tconst hadFocus = this._hasFocus;\n\n\t\t\tthis._setHasFocus(true);\n\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {\n\t\t\t\t// When \"tabbing into\" the textarea, immediately after dispatching the 'focus' event,\n\t\t\t\t// Safari will always move the selection at offset 0 in the textarea\n\t\t\t\tif (!this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0);\n\t\t\t\t}\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value.schedule();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._textArea.onBlur(() => {\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// See https://github.com/microsoft/vscode/issues/112621\n\t\t\t\t// where compositionend is not triggered when the editor\n\t\t\t\t// is taken off-dom during a composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('blurWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t\tthis._setHasFocus(false);\n\t\t}));\n\t\tthis._register(this._textArea.onSyntheticTap(() => {\n\t\t\tif (this._browser.isAndroid && this._currentComposition) {\n\t\t\t\t// on Android, tapping does not cancel the current composition, so the\n\t\t\t\t// textarea is stuck showing the old composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('tapWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _installSelectionChangeListener(): IDisposable {\n\t\t// See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256\n\t\t// When using a Braille display, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event.\n\t\t//\n\t\t// The `selectionchange` event appears to be emitted under numerous other circumstances,\n\t\t// so it is quite a challenge to distinguish a `selectionchange` coming in from a user\n\t\t// using a Braille display from all the other cases.\n\t\t//\n\t\t// The problems with the `selectionchange` event are:\n\t\t// * the event is emitted when the textarea is focused programmatically -- textarea.focus()\n\t\t// * the event is emitted when the selection is changed in the textarea programmatically -- textarea.setSelectionRange(...)\n\t\t// * the event is emitted when the value of the textarea is changed programmatically -- textarea.value = '...'\n\t\t// * the event is emitted when tabbing into the textarea\n\t\t// * the event is emitted asynchronously (sometimes with a delay as high as a few tens of ms)\n\t\t// * the event sometimes comes in bursts for a single logical textarea operation\n\n\t\t// `selectionchange` events often come multiple times for a single logical change\n\t\t// so throttle multiple `selectionchange` events that burst in a short period of time.\n\t\tlet previousSelectionChangeEventTime = 0;\n\t\treturn dom.addDisposableListener(this._textArea.ownerDocument, 'selectionchange', (e) => {//todo\n\t\t\tinputLatency.onSelectionChange();\n\n\t\t\tif (!this._hasFocus) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._browser.isChrome) {\n\t\t\t\t// Support only for Chrome until testing happens on other browsers\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst now = Date.now();\n\n\t\t\tconst delta1 = now - previousSelectionChangeEventTime;\n\t\t\tpreviousSelectionChangeEventTime = now;\n\t\t\tif (delta1 < 5) {\n\t\t\t\t// received another `selectionchange` event within 5ms of the previous `selectionchange` event\n\t\t\t\t// => ignore it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst delta2 = now - this._textArea.getIgnoreSelectionChangeTime();\n\t\t\tthis._textArea.resetSelectionChangeTime();\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the textarea\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!this._textAreaState.selection) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newValue = this._textArea.getValue();\n\t\t\tif (this._textAreaState.value !== newValue) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newSelectionStart = this._textArea.getSelectionStart();\n\t\t\tconst newSelectionEnd = this._textArea.getSelectionEnd();\n\t\t\tif (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {\n\t\t\t\t// Nothing to do...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);\n\t\t\tconst newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0]!, _newSelectionStartPosition[1], _newSelectionStartPosition[2]);\n\n\t\t\tconst _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);\n\t\t\tconst newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0]!, _newSelectionEndPosition[1], _newSelectionEndPosition[2]);\n\n\t\t\tconst newSelection = new Selection(\n\t\t\t\tnewSelectionStartPosition.lineNumber, newSelectionStartPosition.column,\n\t\t\t\tnewSelectionEndPosition.lineNumber, newSelectionEndPosition.column\n\t\t\t);\n\n\t\t\tthis._onSelectionChangeRequest.fire(newSelection);\n\t\t});\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t}\n\n\tpublic focusTextArea(): void {\n\t\t// Setting this._hasFocus and writing the screen reader content\n\t\t// will result in a focus() and setSelectionRange() in the textarea\n\t\tthis._setHasFocus(true);\n\n\t\t// If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus\n\t\tthis.refreshFocusState();\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._hasFocus;\n\t}\n\n\tpublic refreshFocusState(): void {\n\t\tthis._setHasFocus(this._textArea.hasFocus());\n\t}\n\n\tprivate _setHasFocus(newHasFocus: boolean): void {\n\t\tif (this._hasFocus === newHasFocus) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._hasFocus = newHasFocus;\n\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t\tif (this._hasFocus) {\n\t\t\tthis._selectionChangeListener = this._installSelectionChangeListener();\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis.writeNativeTextAreaContent('focusgain');\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis._onFocus.fire();\n\t\t} else {\n\t\t\tthis._onBlur.fire();\n\t\t}\n\t}\n\n\tprivate _setAndWriteTextAreaState(reason: string, textAreaState: TextAreaState): void {\n\t\tif (!this._hasFocus) {\n\t\t\ttextAreaState = textAreaState.collapseSelection();\n\t\t}\n\t\tif (!textAreaState.isWrittenToTextArea(this._textArea, this._hasFocus)) {\n\t\t\tthis._logService.trace(`writeTextAreaState(reason: ${reason})`);\n\t\t}\n\t\ttextAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);\n\t\tthis._textAreaState = textAreaState;\n\t}\n\n\tpublic writeNativeTextAreaContent(reason: string): void {\n\t\tif ((!this._accessibilityService.isScreenReaderOptimized() && reason === 'render') || this._currentComposition) {\n\t\t\t// Do not write to the text on render unless a screen reader is being used #192278\n\t\t\t// Do not write to the text area when doing composition\n\t\t\treturn;\n\t\t}\n\t\tthis._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());\n\t}\n}\n\nexport class TextAreaWrapper extends Disposable implements ICompleteTextAreaWrapper {\n\n\tpublic readonly onKeyDown: Event<KeyboardEvent>;\n\tpublic readonly onKeyPress: Event<KeyboardEvent>;\n\tpublic readonly onKeyUp: Event<KeyboardEvent>;\n\tpublic readonly onCompositionStart: Event<CompositionEvent>;\n\tpublic readonly onCompositionUpdate: Event<CompositionEvent>;\n\tpublic readonly onCompositionEnd: Event<CompositionEvent>;\n\tpublic readonly onBeforeInput: Event<InputEvent>;\n\tpublic readonly onInput: Event<InputEvent>;\n\tpublic readonly onCut: Event<ClipboardEvent>;\n\tpublic readonly onCopy: Event<ClipboardEvent>;\n\tpublic readonly onPaste: Event<ClipboardEvent>;\n\tpublic readonly onFocus: Event<FocusEvent>;\n\tpublic readonly onBlur: Event<FocusEvent>; // = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\tpublic get ownerDocument(): Document {\n\t\treturn this._actual.ownerDocument;\n\t}\n\n\tprivate _onSyntheticTap = this._register(new Emitter<void>());\n\tpublic readonly onSyntheticTap: Event<void> = this._onSyntheticTap.event;\n\n\tprivate _ignoreSelectionChangeTime: number;\n\n\tconstructor(\n\t\tprivate readonly _actual: HTMLTextAreaElement\n\t) {\n\t\tsuper();\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t\tthis.onKeyDown = this._register(new DomEmitter(this._actual, 'keydown')).event;\n\t\tthis.onKeyPress = this._register(new DomEmitter(this._actual, 'keypress')).event;\n\t\tthis.onKeyUp = this._register(new DomEmitter(this._actual, 'keyup')).event;\n\t\tthis.onCompositionStart = this._register(new DomEmitter(this._actual, 'compositionstart')).event;\n\t\tthis.onCompositionUpdate = this._register(new DomEmitter(this._actual, 'compositionupdate')).event;\n\t\tthis.onCompositionEnd = this._register(new DomEmitter(this._actual, 'compositionend')).event;\n\t\tthis.onBeforeInput = this._register(new DomEmitter(this._actual, 'beforeinput')).event;\n\t\tthis.onInput = <Event<InputEvent>>this._register(new DomEmitter(this._actual, 'input')).event;\n\t\tthis.onCut = this._register(new DomEmitter(this._actual, 'cut')).event;\n\t\tthis.onCopy = this._register(new DomEmitter(this._actual, 'copy')).event;\n\t\tthis.onPaste = this._register(new DomEmitter(this._actual, 'paste')).event;\n\t\tthis.onFocus = this._register(new DomEmitter(this._actual, 'focus')).event;\n\t\tthis.onBlur = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\t\tthis._register(this.onKeyDown(() => inputLatency.onKeyDown()));\n\t\tthis._register(this.onBeforeInput(() => inputLatency.onBeforeInput()));\n\t\tthis._register(this.onInput(() => inputLatency.onInput()));\n\t\tthis._register(this.onKeyUp(() => inputLatency.onKeyUp()));\n\t\tthis._register(dom.addDisposableListener(this._actual, TextAreaSyntethicEvents.Tap, () => this._onSyntheticTap.fire()));\n\t}\n\n\tpublic hasFocus(): boolean {\n\t\tconst shadowRoot = dom.getShadowRoot(this._actual);\n\t\tif (shadowRoot) {\n\t\t\treturn shadowRoot.activeElement === this._actual;\n\t\t} else if (this._actual.isConnected) {\n\t\t\treturn dom.getActiveElement() === this._actual;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tpublic getIgnoreSelectionChangeTime(): number {\n\t\treturn this._ignoreSelectionChangeTime;\n\t}\n\n\tpublic resetSelectionChangeTime(): void {\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t}\n\n\tpublic getValue(): string {\n\t\t// console.log('current value: ' + this._textArea.value);\n\t\treturn this._actual.value;\n\t}\n\n\tpublic setValue(reason: string, value: string): void {\n\t\tconst textArea = this._actual;\n\t\tif (textArea.value === value) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\t\t// console.log('reason: ' + reason + ', current value: ' + textArea.value + ' => new value: ' + value);\n\t\tthis.setIgnoreSelectionChangeTime('setValue');\n\t\ttextArea.value = value;\n\t}\n\n\tpublic getSelectionStart(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionEnd : this._actual.selectionStart;\n\t}\n\n\tpublic getSelectionEnd(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionStart : this._actual.selectionEnd;\n\t}\n\n\tpublic setSelectionRange(reason: string, selectionStart: number, selectionEnd: number): void {\n\t\tconst textArea = this._actual;\n\n\t\tlet activeElement: Element | null = null;\n\t\tconst shadowRoot = dom.getShadowRoot(textArea);\n\t\tif (shadowRoot) {\n\t\t\tactiveElement = shadowRoot.activeElement;\n\t\t} else {\n\t\t\tactiveElement = dom.getActiveElement();\n\t\t}\n\t\tconst activeWindow = dom.getWindow(activeElement);\n\n\t\tconst currentIsFocused = (activeElement === textArea);\n\t\tconst currentSelectionStart = textArea.selectionStart;\n\t\tconst currentSelectionEnd = textArea.selectionEnd;\n\n\t\tif (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {\n\t\t\t// No change\n\t\t\t// Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// console.log('reason: ' + reason + ', setSelectionRange: ' + selectionStart + ' -> ' + selectionEnd);\n\n\t\tif (currentIsFocused) {\n\t\t\t// No need to focus, only need to change the selection range\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If the focus is outside the textarea, browsers will try really hard to reveal the textarea.\n\t\t// Here, we try to undo the browser's desperate reveal.\n\t\ttry {\n\t\t\tconst scrollState = dom.saveParentsScrollTop(textArea);\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.focus();\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tdom.restoreParentsScrollTop(textArea, scrollState);\n\t\t} catch (e) {\n\t\t\t// Sometimes IE throws when setting selection (e.g. textarea is off-DOM)\n\t\t}\n\t}\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 browser from '../../../../../base/browser/browser.js';\nimport * as dom from '../../../../../base/browser/dom.js';\nimport { DomEmitter } from '../../../../../base/browser/event.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { inputLatency } from '../../../../../base/browser/performance.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { OperatingSystem } from '../../../../../base/common/platform.js';\nimport * as strings from '../../../../../base/common/strings.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { ensureClipboardGetsEditorSelection, computePasteData, InMemoryClipboardMetadataManager, IPasteData, getPasteDataFromMetadata } from '../clipboardUtils.js';\nimport { _debugComposition, ITextAreaWrapper, ITypeData, TextAreaState } from './textAreaEditContextState.js';\nimport { ViewContext } from '../../../../common/viewModel/viewContext.js';\n\nexport namespace TextAreaSyntethicEvents {\n\texport const Tap = '-monaco-textarea-synthetic-tap';\n}\n\nexport interface ICompositionData {\n}\n\nexport interface ITextAreaInputHost {\n\treadonly context: ViewContext | null;\n\tgetScreenReaderContent(): TextAreaState;\n\tdeduceModelPosition(viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position;\n}\n\nexport interface ICompositionStartEvent {\n\tdata: string;\n}\n\nexport interface ICompleteTextAreaWrapper extends ITextAreaWrapper {\n\treadonly onKeyDown: Event<KeyboardEvent>;\n\treadonly onKeyUp: Event<KeyboardEvent>;\n\treadonly onCompositionStart: Event<CompositionEvent>;\n\treadonly onCompositionUpdate: Event<CompositionEvent>;\n\treadonly onCompositionEnd: Event<CompositionEvent>;\n\treadonly onInput: Event<InputEvent>;\n\treadonly onCut: Event<ClipboardEvent>;\n\treadonly onCopy: Event<ClipboardEvent>;\n\treadonly onPaste: Event<ClipboardEvent>;\n\treadonly onFocus: Event<FocusEvent>;\n\treadonly onBlur: Event<FocusEvent>;\n\treadonly onSyntheticTap: Event<void>;\n\n\treadonly ownerDocument: Document;\n\n\tsetIgnoreSelectionChangeTime(reason: string): void;\n\tgetIgnoreSelectionChangeTime(): number;\n\tresetSelectionChangeTime(): void;\n\n\thasFocus(): boolean;\n}\n\nexport interface IBrowser {\n\tisAndroid: boolean;\n\tisFirefox: boolean;\n\tisChrome: boolean;\n\tisSafari: boolean;\n}\n\nclass CompositionContext {\n\n\tprivate _lastTypeTextLength: number;\n\n\tconstructor() {\n\t\tthis._lastTypeTextLength = 0;\n\t}\n\n\tpublic handleCompositionUpdate(text: string | null | undefined): ITypeData {\n\t\ttext = text || '';\n\t\tconst typeInput: ITypeData = {\n\t\t\ttext: text,\n\t\t\treplacePrevCharCnt: this._lastTypeTextLength,\n\t\t\treplaceNextCharCnt: 0,\n\t\t\tpositionDelta: 0\n\t\t};\n\t\tthis._lastTypeTextLength = text.length;\n\t\treturn typeInput;\n\t}\n}\n\n/**\n * Writes screen reader content to the textarea and is able to analyze its input events to generate:\n * - onCut\n * - onPaste\n * - onType\n *\n * Composition events are generated for presentation purposes (composition input is reflected in onType).\n */\nexport class TextAreaInput extends Disposable {\n\n\tprivate _onFocus = this._register(new Emitter<void>());\n\tpublic readonly onFocus: Event<void> = this._onFocus.event;\n\n\tprivate _onBlur = this._register(new Emitter<void>());\n\tpublic readonly onBlur: Event<void> = this._onBlur.event;\n\n\tprivate _onKeyDown = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;\n\n\tprivate _onKeyUp = this._register(new Emitter<IKeyboardEvent>());\n\tpublic readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;\n\n\tprivate _onCut = this._register(new Emitter<void>());\n\tpublic readonly onCut: Event<void> = this._onCut.event;\n\n\tprivate _onPaste = this._register(new Emitter<IPasteData>());\n\tpublic readonly onPaste: Event<IPasteData> = this._onPaste.event;\n\n\tprivate _onType = this._register(new Emitter<ITypeData>());\n\tpublic readonly onType: Event<ITypeData> = this._onType.event;\n\n\tprivate _onCompositionStart = this._register(new Emitter<ICompositionStartEvent>());\n\tpublic readonly onCompositionStart: Event<ICompositionStartEvent> = this._onCompositionStart.event;\n\n\tprivate _onCompositionUpdate = this._register(new Emitter<ICompositionData>());\n\tpublic readonly onCompositionUpdate: Event<ICompositionData> = this._onCompositionUpdate.event;\n\n\tprivate _onCompositionEnd = this._register(new Emitter<void>());\n\tpublic readonly onCompositionEnd: Event<void> = this._onCompositionEnd.event;\n\n\tprivate _onSelectionChangeRequest = this._register(new Emitter<Selection>());\n\tpublic readonly onSelectionChangeRequest: Event<Selection> = this._onSelectionChangeRequest.event;\n\n\t// ---\n\n\tprivate readonly _asyncTriggerCut: RunOnceScheduler;\n\n\tprivate readonly _asyncFocusGainWriteScreenReaderContent: MutableDisposable<RunOnceScheduler> = this._register(new MutableDisposable());\n\n\tprivate _textAreaState: TextAreaState;\n\n\tpublic get textAreaState(): TextAreaState {\n\t\treturn this._textAreaState;\n\t}\n\n\tprivate _selectionChangeListener: IDisposable | null;\n\n\tprivate _hasFocus: boolean;\n\tprivate _currentComposition: CompositionContext | null;\n\n\tconstructor(\n\t\tprivate readonly _host: ITextAreaInputHost,\n\t\tprivate readonly _textArea: ICompleteTextAreaWrapper,\n\t\tprivate readonly _OS: OperatingSystem,\n\t\tprivate readonly _browser: IBrowser,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t\t@ILogService private readonly _logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));\n\t\tthis._textAreaState = TextAreaState.EMPTY;\n\t\tthis._selectionChangeListener = null;\n\t\tif (this._accessibilityService.isScreenReaderOptimized()) {\n\t\t\tthis.writeNativeTextAreaContent('ctor');\n\t\t}\n\t\tthis._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0));\n\t\t\t} else {\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.clear();\n\t\t\t}\n\t\t}));\n\t\tthis._hasFocus = false;\n\t\tthis._currentComposition = null;\n\n\t\tlet lastKeyDown: IKeyboardEvent | null = null;\n\n\t\tthis._register(this._textArea.onKeyDown((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tif (e.keyCode === KeyCode.KEY_IN_COMPOSITION\n\t\t\t\t|| (this._currentComposition && e.keyCode === KeyCode.Backspace)) {\n\t\t\t\t// Stop propagation for keyDown events if the IME is processing key input\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\n\t\t\tif (e.equals(KeyCode.Escape)) {\n\t\t\t\t// Prevent default always for `Esc`, otherwise it will generate a keypress\n\t\t\t\t// See https://msdn.microsoft.com/en-us/library/ie/ms536939(v=vs.85).aspx\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\tlastKeyDown = e;\n\t\t\tthis._onKeyDown.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onKeyUp((_e) => {\n\t\t\tconst e = new StandardKeyboardEvent(_e);\n\t\t\tthis._onKeyUp.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionStart((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionstart]`, e);\n\t\t\t}\n\n\t\t\tconst currentComposition = new CompositionContext();\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// simply reset the composition context\n\t\t\t\tthis._currentComposition = currentComposition;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = currentComposition;\n\n\t\t\tif (\n\t\t\t\tthis._OS === OperatingSystem.Macintosh\n\t\t\t\t&& lastKeyDown\n\t\t\t\t&& lastKeyDown.equals(KeyCode.KEY_IN_COMPOSITION)\n\t\t\t\t&& this._textAreaState.selectionStart === this._textAreaState.selectionEnd\n\t\t\t\t&& this._textAreaState.selectionStart > 0\n\t\t\t\t&& this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data\n\t\t\t\t&& (lastKeyDown.code === 'ArrowRight' || lastKeyDown.code === 'ArrowLeft')\n\t\t\t) {\n\t\t\t\t// Handling long press case on Chromium/Safari macOS + arrow key => pretend the character was selected\n\t\t\t\tif (_debugComposition) {\n\t\t\t\t\tconsole.log(`[compositionstart] Handling long press case on macOS + arrow key`, e);\n\t\t\t\t}\n\t\t\t\t// Pretend the previous character was composed (in order to get it removed by subsequent compositionupdate events)\n\t\t\t\tcurrentComposition.handleCompositionUpdate('x');\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// when tapping on the editor, Android enters composition mode to edit the current word\n\t\t\t\t// so we cannot clear the textarea on Android and we must pretend the current word was selected\n\t\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._onCompositionStart.fire({ data: e.data });\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionUpdate((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionupdate]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// should not be possible to receive a 'compositionupdate' without a 'compositionstart'\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionUpdate.fire(e);\n\t\t}));\n\n\t\tthis._register(this._textArea.onCompositionEnd((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[compositionend]`, e);\n\t\t\t}\n\t\t\tconst currentComposition = this._currentComposition;\n\t\t\tif (!currentComposition) {\n\t\t\t\t// https://github.com/microsoft/monaco-editor/issues/1663\n\t\t\t\t// On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._currentComposition = null;\n\n\t\t\tif (this._browser.isAndroid) {\n\t\t\t\t// On Android, the data sent with the composition update event is unusable.\n\t\t\t\t// For example, if the cursor is in the middle of a word like Mic|osoft\n\t\t\t\t// and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n\t\t\t\t// This is not really usable because it doesn't tell us where the edit began and where it ended.\n\t\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\t\tconst typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n\t\t\t\tthis._textAreaState = newState;\n\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst typeInput = currentComposition.handleCompositionUpdate(e.data);\n\t\t\tthis._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tthis._onType.fire(typeInput);\n\t\t\tthis._onCompositionEnd.fire();\n\t\t}));\n\n\t\tthis._register(this._textArea.onInput((e) => {\n\t\t\tif (_debugComposition) {\n\t\t\t\tconsole.log(`[input]`, e);\n\t\t\t}\n\n\t\t\t// Pretend here we touched the text area, as the `input` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received input event');\n\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n\t\t\tconst typeInput = TextAreaState.deduceInput(this._textAreaState, newState, /*couldBeEmojiInput*/this._OS === OperatingSystem.Macintosh);\n\n\t\t\tif (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1) {\n\t\t\t\t// one character was typed\n\t\t\t\tif (\n\t\t\t\t\tstrings.isHighSurrogate(typeInput.text.charCodeAt(0))\n\t\t\t\t\t|| typeInput.text.charCodeAt(0) === 0x7f /* Delete */\n\t\t\t\t) {\n\t\t\t\t\t// Ignore invalid input but keep it around for next time\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._textAreaState = newState;\n\t\t\tif (\n\t\t\t\ttypeInput.text !== ''\n\t\t\t\t|| typeInput.replacePrevCharCnt !== 0\n\t\t\t\t|| typeInput.replaceNextCharCnt !== 0\n\t\t\t\t|| typeInput.positionDelta !== 0\n\t\t\t) {\n\t\t\t\t// https://w3c.github.io/input-events/#interface-InputEvent-Attributes\n\t\t\t\tif (this._host.context && e.inputType === 'insertFromPaste') {\n\t\t\t\t\tthis._onPaste.fire(getPasteDataFromMetadata(\n\t\t\t\t\t\ttypeInput.text,\n\t\t\t\t\t\tInMemoryClipboardMetadataManager.INSTANCE.get(typeInput.text),\n\t\t\t\t\t\tthis._host.context\n\t\t\t\t\t));\n\t\t\t\t} else {\n\t\t\t\t\tthis._onType.fire(typeInput);\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\t// --- Clipboard operations\n\n\t\tthis._register(this._textArea.onCut((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCut`, e);\n\t\t\t// Pretend here we touched the text area, as the `cut` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received cut event');\n\n\t\t\tif (this._host.context) {\n\t\t\t\tensureClipboardGetsEditorSelection(e, this._host.context, this._logService, this._browser.isFirefox);\n\t\t\t}\n\t\t\tthis._asyncTriggerCut.schedule();\n\t\t}));\n\n\t\tthis._register(this._textArea.onCopy((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onCopy`, e);\n\t\t\tif (this._host.context) {\n\t\t\t\tensureClipboardGetsEditorSelection(e, this._host.context, this._logService, this._browser.isFirefox);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this._textArea.onPaste((e) => {\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste`, e);\n\t\t\t// Pretend here we touched the text area, as the `paste` event will most likely\n\t\t\t// result in a `selectionchange` event which we want to ignore\n\t\t\tthis._textArea.setIgnoreSelectionChangeTime('received paste event');\n\t\t\tif (!this._host.context) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst pasteData = computePasteData(e, this._host.context, this._logService);\n\t\t\tif (!pasteData) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._logService.trace(`TextAreaInput#onPaste (before onPaste)`);\n\t\t\tthis._onPaste.fire(pasteData);\n\t\t}));\n\n\t\tthis._register(this._textArea.onFocus(() => {\n\t\t\tconst hadFocus = this._hasFocus;\n\n\t\t\tthis._setHasFocus(true);\n\n\t\t\tif (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {\n\t\t\t\t// When \"tabbing into\" the textarea, immediately after dispatching the 'focus' event,\n\t\t\t\t// Safari will always move the selection at offset 0 in the textarea\n\t\t\t\tif (!this._asyncFocusGainWriteScreenReaderContent.value) {\n\t\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0);\n\t\t\t\t}\n\t\t\t\tthis._asyncFocusGainWriteScreenReaderContent.value.schedule();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._textArea.onBlur(() => {\n\t\t\tif (this._currentComposition) {\n\t\t\t\t// See https://github.com/microsoft/vscode/issues/112621\n\t\t\t\t// where compositionend is not triggered when the editor\n\t\t\t\t// is taken off-dom during a composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('blurWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t\tthis._setHasFocus(false);\n\t\t}));\n\t\tthis._register(this._textArea.onSyntheticTap(() => {\n\t\t\tif (this._browser.isAndroid && this._currentComposition) {\n\t\t\t\t// on Android, tapping does not cancel the current composition, so the\n\t\t\t\t// textarea is stuck showing the old composition\n\n\t\t\t\t// Clear the flag to be able to write to the textarea\n\t\t\t\tthis._currentComposition = null;\n\n\t\t\t\t// Clear the textarea to avoid an unwanted cursor type\n\t\t\t\tthis.writeNativeTextAreaContent('tapWithoutCompositionEnd');\n\n\t\t\t\t// Fire artificial composition end\n\t\t\t\tthis._onCompositionEnd.fire();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _installSelectionChangeListener(): IDisposable {\n\t\t// See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256\n\t\t// When using a Braille display, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event.\n\t\t//\n\t\t// The `selectionchange` event appears to be emitted under numerous other circumstances,\n\t\t// so it is quite a challenge to distinguish a `selectionchange` coming in from a user\n\t\t// using a Braille display from all the other cases.\n\t\t//\n\t\t// The problems with the `selectionchange` event are:\n\t\t// * the event is emitted when the textarea is focused programmatically -- textarea.focus()\n\t\t// * the event is emitted when the selection is changed in the textarea programmatically -- textarea.setSelectionRange(...)\n\t\t// * the event is emitted when the value of the textarea is changed programmatically -- textarea.value = '...'\n\t\t// * the event is emitted when tabbing into the textarea\n\t\t// * the event is emitted asynchronously (sometimes with a delay as high as a few tens of ms)\n\t\t// * the event sometimes comes in bursts for a single logical textarea operation\n\n\t\t// `selectionchange` events often come multiple times for a single logical change\n\t\t// so throttle multiple `selectionchange` events that burst in a short period of time.\n\t\tlet previousSelectionChangeEventTime = 0;\n\t\treturn dom.addDisposableListener(this._textArea.ownerDocument, 'selectionchange', (e) => {//todo\n\t\t\tinputLatency.onSelectionChange();\n\n\t\t\tif (!this._hasFocus) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._currentComposition) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._browser.isChrome) {\n\t\t\t\t// Support only for Chrome until testing happens on other browsers\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst now = Date.now();\n\n\t\t\tconst delta1 = now - previousSelectionChangeEventTime;\n\t\t\tpreviousSelectionChangeEventTime = now;\n\t\t\tif (delta1 < 5) {\n\t\t\t\t// received another `selectionchange` event within 5ms of the previous `selectionchange` event\n\t\t\t\t// => ignore it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst delta2 = now - this._textArea.getIgnoreSelectionChangeTime();\n\t\t\tthis._textArea.resetSelectionChangeTime();\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the textarea\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!this._textAreaState.selection) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newValue = this._textArea.getValue();\n\t\t\tif (this._textAreaState.value !== newValue) {\n\t\t\t\t// Cannot correlate a position in the textarea with a position in the editor...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newSelectionStart = this._textArea.getSelectionStart();\n\t\t\tconst newSelectionEnd = this._textArea.getSelectionEnd();\n\t\t\tif (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {\n\t\t\t\t// Nothing to do...\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);\n\t\t\tconst newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0]!, _newSelectionStartPosition[1], _newSelectionStartPosition[2]);\n\n\t\t\tconst _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);\n\t\t\tconst newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0]!, _newSelectionEndPosition[1], _newSelectionEndPosition[2]);\n\n\t\t\tconst newSelection = new Selection(\n\t\t\t\tnewSelectionStartPosition.lineNumber, newSelectionStartPosition.column,\n\t\t\t\tnewSelectionEndPosition.lineNumber, newSelectionEndPosition.column\n\t\t\t);\n\n\t\t\tthis._onSelectionChangeRequest.fire(newSelection);\n\t\t});\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t}\n\n\tpublic focusTextArea(): void {\n\t\t// Setting this._hasFocus and writing the screen reader content\n\t\t// will result in a focus() and setSelectionRange() in the textarea\n\t\tthis._setHasFocus(true);\n\n\t\t// If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus\n\t\tthis.refreshFocusState();\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._hasFocus;\n\t}\n\n\tpublic refreshFocusState(): void {\n\t\tthis._setHasFocus(this._textArea.hasFocus());\n\t}\n\n\tprivate _setHasFocus(newHasFocus: boolean): void {\n\t\tif (this._hasFocus === newHasFocus) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._hasFocus = newHasFocus;\n\n\t\tif (this._selectionChangeListener) {\n\t\t\tthis._selectionChangeListener.dispose();\n\t\t\tthis._selectionChangeListener = null;\n\t\t}\n\t\tif (this._hasFocus) {\n\t\t\tthis._selectionChangeListener = this._installSelectionChangeListener();\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis.writeNativeTextAreaContent('focusgain');\n\t\t}\n\n\t\tif (this._hasFocus) {\n\t\t\tthis._onFocus.fire();\n\t\t} else {\n\t\t\tthis._onBlur.fire();\n\t\t}\n\t}\n\n\tprivate _setAndWriteTextAreaState(reason: string, textAreaState: TextAreaState): void {\n\t\tif (!this._hasFocus) {\n\t\t\ttextAreaState = textAreaState.collapseSelection();\n\t\t}\n\t\tif (!textAreaState.isWrittenToTextArea(this._textArea, this._hasFocus)) {\n\t\t\tthis._logService.trace(`writeTextAreaState(reason: ${reason})`);\n\t\t}\n\t\ttextAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);\n\t\tthis._textAreaState = textAreaState;\n\t}\n\n\tpublic writeNativeTextAreaContent(reason: string): void {\n\t\tif ((!this._accessibilityService.isScreenReaderOptimized() && reason === 'render') || this._currentComposition) {\n\t\t\t// Do not write to the text on render unless a screen reader is being used #192278\n\t\t\t// Do not write to the text area when doing composition\n\t\t\treturn;\n\t\t}\n\t\tthis._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());\n\t}\n}\n\nexport class TextAreaWrapper extends Disposable implements ICompleteTextAreaWrapper {\n\n\tpublic readonly onKeyDown: Event<KeyboardEvent>;\n\tpublic readonly onKeyPress: Event<KeyboardEvent>;\n\tpublic readonly onKeyUp: Event<KeyboardEvent>;\n\tpublic readonly onCompositionStart: Event<CompositionEvent>;\n\tpublic readonly onCompositionUpdate: Event<CompositionEvent>;\n\tpublic readonly onCompositionEnd: Event<CompositionEvent>;\n\tpublic readonly onBeforeInput: Event<InputEvent>;\n\tpublic readonly onInput: Event<InputEvent>;\n\tpublic readonly onCut: Event<ClipboardEvent>;\n\tpublic readonly onCopy: Event<ClipboardEvent>;\n\tpublic readonly onPaste: Event<ClipboardEvent>;\n\tpublic readonly onFocus: Event<FocusEvent>;\n\tpublic readonly onBlur: Event<FocusEvent>; // = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\tpublic get ownerDocument(): Document {\n\t\treturn this._actual.ownerDocument;\n\t}\n\n\tprivate _onSyntheticTap = this._register(new Emitter<void>());\n\tpublic readonly onSyntheticTap: Event<void> = this._onSyntheticTap.event;\n\n\tprivate _ignoreSelectionChangeTime: number;\n\n\tconstructor(\n\t\tprivate readonly _actual: HTMLTextAreaElement\n\t) {\n\t\tsuper();\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t\tthis.onKeyDown = this._register(new DomEmitter(this._actual, 'keydown')).event;\n\t\tthis.onKeyPress = this._register(new DomEmitter(this._actual, 'keypress')).event;\n\t\tthis.onKeyUp = this._register(new DomEmitter(this._actual, 'keyup')).event;\n\t\tthis.onCompositionStart = this._register(new DomEmitter(this._actual, 'compositionstart')).event;\n\t\tthis.onCompositionUpdate = this._register(new DomEmitter(this._actual, 'compositionupdate')).event;\n\t\tthis.onCompositionEnd = this._register(new DomEmitter(this._actual, 'compositionend')).event;\n\t\tthis.onBeforeInput = this._register(new DomEmitter(this._actual, 'beforeinput')).event;\n\t\tthis.onInput = <Event<InputEvent>>this._register(new DomEmitter(this._actual, 'input')).event;\n\t\tthis.onCut = this._register(new DomEmitter(this._actual, 'cut')).event;\n\t\tthis.onCopy = this._register(new DomEmitter(this._actual, 'copy')).event;\n\t\tthis.onPaste = this._register(new DomEmitter(this._actual, 'paste')).event;\n\t\tthis.onFocus = this._register(new DomEmitter(this._actual, 'focus')).event;\n\t\tthis.onBlur = this._register(new DomEmitter(this._actual, 'blur')).event;\n\n\t\tthis._register(this.onKeyDown(() => inputLatency.onKeyDown()));\n\t\tthis._register(this.onBeforeInput(() => inputLatency.onBeforeInput()));\n\t\tthis._register(this.onInput(() => inputLatency.onInput()));\n\t\tthis._register(this.onKeyUp(() => inputLatency.onKeyUp()));\n\t\tthis._register(dom.addDisposableListener(this._actual, TextAreaSyntethicEvents.Tap, () => this._onSyntheticTap.fire()));\n\t}\n\n\tpublic hasFocus(): boolean {\n\t\tconst shadowRoot = dom.getShadowRoot(this._actual);\n\t\tif (shadowRoot) {\n\t\t\treturn shadowRoot.activeElement === this._actual;\n\t\t} else if (this._actual.isConnected) {\n\t\t\treturn dom.getActiveElement() === this._actual;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tpublic getIgnoreSelectionChangeTime(): number {\n\t\treturn this._ignoreSelectionChangeTime;\n\t}\n\n\tpublic resetSelectionChangeTime(): void {\n\t\tthis._ignoreSelectionChangeTime = 0;\n\t}\n\n\tpublic getValue(): string {\n\t\t// console.log('current value: ' + this._textArea.value);\n\t\treturn this._actual.value;\n\t}\n\n\tpublic setValue(reason: string, value: string): void {\n\t\tconst textArea = this._actual;\n\t\tif (textArea.value === value) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\t\t// console.log('reason: ' + reason + ', current value: ' + textArea.value + ' => new value: ' + value);\n\t\tthis.setIgnoreSelectionChangeTime('setValue');\n\t\ttextArea.value = value;\n\t}\n\n\tpublic getSelectionStart(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionEnd : this._actual.selectionStart;\n\t}\n\n\tpublic getSelectionEnd(): number {\n\t\treturn this._actual.selectionDirection === 'backward' ? this._actual.selectionStart : this._actual.selectionEnd;\n\t}\n\n\tpublic setSelectionRange(reason: string, selectionStart: number, selectionEnd: number): void {\n\t\tconst textArea = this._actual;\n\n\t\tlet activeElement: Element | null = null;\n\t\tconst shadowRoot = dom.getShadowRoot(textArea);\n\t\tif (shadowRoot) {\n\t\t\tactiveElement = shadowRoot.activeElement;\n\t\t} else {\n\t\t\tactiveElement = dom.getActiveElement();\n\t\t}\n\t\tconst activeWindow = dom.getWindow(activeElement);\n\n\t\tconst currentIsFocused = (activeElement === textArea);\n\t\tconst currentSelectionStart = textArea.selectionStart;\n\t\tconst currentSelectionEnd = textArea.selectionEnd;\n\n\t\tif (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {\n\t\t\t// No change\n\t\t\t// Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// console.log('reason: ' + reason + ', setSelectionRange: ' + selectionStart + ' -> ' + selectionEnd);\n\n\t\tif (currentIsFocused) {\n\t\t\t// No need to focus, only need to change the selection range\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tif (browser.isFirefox && activeWindow.parent !== activeWindow) {\n\t\t\t\ttextArea.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If the focus is outside the textarea, browsers will try really hard to reveal the textarea.\n\t\t// Here, we try to undo the browser's desperate reveal.\n\t\ttry {\n\t\t\tconst scrollState = dom.saveParentsScrollTop(textArea);\n\t\t\tthis.setIgnoreSelectionChangeTime('setSelectionRange');\n\t\t\ttextArea.focus();\n\t\t\ttextArea.setSelectionRange(selectionStart, selectionEnd);\n\t\t\tdom.restoreParentsScrollTop(textArea, scrollState);\n\t\t} catch (e) {\n\t\t\t// Sometimes IE throws when setting selection (e.g. textarea is off-DOM)\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
class TextAreaEditContextRegistryImpl {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._textAreaEditContextMapping = new Map();
|
|
8
|
+
}
|
|
9
|
+
register(ownerID, textAreaEditContext) {
|
|
10
|
+
this._textAreaEditContextMapping.set(ownerID, textAreaEditContext);
|
|
11
|
+
return {
|
|
12
|
+
dispose: () => {
|
|
13
|
+
this._textAreaEditContextMapping.delete(ownerID);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export const TextAreaEditContextRegistry = new TextAreaEditContextRegistryImpl();
|
|
19
|
+
//# sourceMappingURL=textAreaEditContextRegistry.js.map
|
package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.ts","vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAKhG,MAAM,+BAA+B;IAArC;QAES,gCAA2B,GAAqC,IAAI,GAAG,EAAE,CAAC;IAUnF,CAAC;IARA,QAAQ,CAAC,OAAe,EAAE,mBAAwC;QACjE,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACnE,OAAO;YACN,OAAO,EAAE,GAAG,EAAE;gBACb,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAClD,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,+BAA+B,EAAE,CAAC","file":"textAreaEditContextRegistry.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 { IDisposable } from '../../../../../base/common/lifecycle.js';\nimport { TextAreaEditContext } from './textAreaEditContext.js';\n\nclass TextAreaEditContextRegistryImpl {\n\n\tprivate _textAreaEditContextMapping: Map<string, TextAreaEditContext> = new Map();\n\n\tregister(ownerID: string, textAreaEditContext: TextAreaEditContext): IDisposable {\n\t\tthis._textAreaEditContextMapping.set(ownerID, textAreaEditContext);\n\t\treturn {\n\t\t\tdispose: () => {\n\t\t\t\tthis._textAreaEditContextMapping.delete(ownerID);\n\t\t\t}\n\t\t};\n\t}\n}\n\nexport const TextAreaEditContextRegistry = new TextAreaEditContextRegistryImpl();\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 { IDisposable } from '../../../../../base/common/lifecycle.js';\nimport { TextAreaEditContext } from './textAreaEditContext.js';\n\nclass TextAreaEditContextRegistryImpl {\n\n\tprivate _textAreaEditContextMapping: Map<string, TextAreaEditContext> = new Map();\n\n\tregister(ownerID: string, textAreaEditContext: TextAreaEditContext): IDisposable {\n\t\tthis._textAreaEditContextMapping.set(ownerID, textAreaEditContext);\n\t\treturn {\n\t\t\tdispose: () => {\n\t\t\t\tthis._textAreaEditContextMapping.delete(ownerID);\n\t\t\t}\n\t\t};\n\t}\n}\n\nexport const TextAreaEditContextRegistry = new TextAreaEditContextRegistryImpl();\n"]}
|
|
@@ -177,7 +177,20 @@ export class TextAreaState {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
static fromScreenReaderContentState(screenReaderContentState) {
|
|
180
|
-
|
|
180
|
+
let selectionStart;
|
|
181
|
+
let selectionEnd;
|
|
182
|
+
const direction = screenReaderContentState.selection.getDirection();
|
|
183
|
+
switch (direction) {
|
|
184
|
+
case 0 /* SelectionDirection.LTR */:
|
|
185
|
+
selectionStart = screenReaderContentState.selectionStart;
|
|
186
|
+
selectionEnd = screenReaderContentState.selectionEnd;
|
|
187
|
+
break;
|
|
188
|
+
case 1 /* SelectionDirection.RTL */:
|
|
189
|
+
selectionStart = screenReaderContentState.selectionEnd;
|
|
190
|
+
selectionEnd = screenReaderContentState.selectionStart;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
return new TextAreaState(screenReaderContentState.value, selectionStart, selectionEnd, screenReaderContentState.selection, screenReaderContentState.newlineCountBeforeSelection);
|
|
181
194
|
}
|
|
182
195
|
}
|
|
183
196
|
//# sourceMappingURL=textAreaEditContextState.js.map
|