monaco-editor-core 0.53.0 → 0.54.0-dev-20250910

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/esm/nls.keys.json +1 -1
  2. package/esm/nls.messages.de.js +2 -2
  3. package/esm/nls.messages.es.js +2 -2
  4. package/esm/nls.messages.fr.js +2 -2
  5. package/esm/nls.messages.it.js +2 -2
  6. package/esm/nls.messages.ja.js +2 -2
  7. package/esm/nls.messages.js +1 -1
  8. package/esm/nls.messages.json +1 -1
  9. package/esm/nls.messages.ko.js +2 -2
  10. package/esm/nls.messages.ru.js +2 -2
  11. package/esm/nls.messages.zh-cn.js +2 -2
  12. package/esm/nls.messages.zh-tw.js +2 -2
  13. package/esm/nls.metadata.json +0 -2
  14. package/esm/vs/base/browser/domSanitize.js +18 -8
  15. package/esm/vs/base/browser/domSanitize.js.map +1 -1
  16. package/esm/vs/base/browser/domStylesheets.js +3 -0
  17. package/esm/vs/base/browser/domStylesheets.js.map +1 -1
  18. package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  19. package/esm/vs/base/browser/ui/dropdown/dropdown.js +1 -2
  20. package/esm/vs/base/browser/ui/dropdown/dropdown.js.map +1 -1
  21. package/esm/vs/base/common/async.js +6 -173
  22. package/esm/vs/base/common/async.js.map +1 -1
  23. package/esm/vs/base/common/fuzzyScorer.js +6 -3
  24. package/esm/vs/base/common/fuzzyScorer.js.map +1 -1
  25. package/esm/vs/base/common/strings.js +0 -3
  26. package/esm/vs/base/common/strings.js.map +1 -1
  27. package/esm/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js +23 -13
  28. package/esm/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js.map +1 -1
  29. package/esm/vs/editor/browser/services/hoverService/hover.css +1 -1
  30. package/esm/vs/editor/common/config/editorOptions.js +1 -1
  31. package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
  32. package/esm/vs/editor/common/viewModel/screenReaderSimpleModel.js.map +1 -1
  33. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +9 -4
  34. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
  35. package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +2 -2
  36. package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
  37. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +15 -10
  38. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
  39. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +13 -4
  40. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +5 -4
  41. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
  42. package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +1 -1
  43. package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js.map +1 -1
  44. package/esm/vs/platform/actionWidget/browser/actionList.js +2 -2
  45. package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
  46. package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -12
  47. package/esm/vs/platform/actions/browser/actionViewItemService.js.map +1 -1
  48. package/esm/vs/platform/actions/browser/toolbar.js +3 -3
  49. package/esm/vs/platform/actions/browser/toolbar.js.map +1 -1
  50. package/esm/vs/platform/contextkey/common/contextkeys.js +1 -2
  51. package/esm/vs/platform/contextkey/common/contextkeys.js.map +1 -1
  52. package/esm/vs/platform/contextkey/common/scanner.js +5 -5
  53. package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
  54. package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
  55. package/esm/vs/platform/list/browser/listService.js +27 -27
  56. package/esm/vs/platform/markers/common/markerService.js +2 -2
  57. package/esm/vs/platform/markers/common/markers.js +6 -6
  58. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +7 -7
  59. package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
  60. package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
  61. package/esm/vs/platform/quickinput/browser/quickInputActions.js +3 -3
  62. package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
  63. package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
  64. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  65. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
  66. package/esm/vs/platform/theme/common/colorUtils.js +2 -2
  67. package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
  68. package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
  69. package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
  70. package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
  71. package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
  72. package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
  73. package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
  74. package/esm/vs/platform/theme/common/colors/miscColors.js +15 -15
  75. package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
  76. package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
  77. package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
  78. package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
  79. package/esm/vs/platform/workspace/common/workspace.js +1 -1
  80. package/package.json +2 -2
  81. package/version.txt +1 -1
@@ -35,7 +35,7 @@ let RichScreenReaderContent = class RichScreenReaderContent extends Disposable {
35
35
  this._selectionChangeListener = this._register(new MutableDisposable());
36
36
  this._accessibilityPageSize = 1;
37
37
  this._ignoreSelectionChangeTime = 0;
38
- this._state = new RichScreenReaderState([]);
38
+ this._state = RichScreenReaderState.NULL;
39
39
  this._strategy = new RichPagedScreenReaderStrategy();
40
40
  this._renderedLines = new Map();
41
41
  this._renderedSelection = new Selection(1, 1, 1, 1);
@@ -59,7 +59,7 @@ let RichScreenReaderContent = class RichScreenReaderContent extends Disposable {
59
59
  }
60
60
  }
61
61
  else {
62
- this._state = new RichScreenReaderState([]);
62
+ this._state = RichScreenReaderState.NULL;
63
63
  this._setIgnoreSelectionChangeTime('setValue');
64
64
  this._domNode.domNode.textContent = '';
65
65
  }
@@ -285,19 +285,29 @@ class LineInterval {
285
285
  }
286
286
  }
287
287
  class RichScreenReaderState {
288
- constructor(intervals) {
288
+ constructor(model, intervals) {
289
289
  this.intervals = intervals;
290
- }
291
- equals(other) {
292
- if (this.intervals.length !== other.intervals.length) {
293
- return false;
294
- }
295
- for (let i = 0; i < this.intervals.length; i++) {
296
- if (this.intervals[i].startLine !== other.intervals[i].startLine || this.intervals[i].endLine !== other.intervals[i].endLine) {
297
- return false;
290
+ let value = '';
291
+ for (const interval of intervals) {
292
+ for (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {
293
+ value += model.getLineContent(lineNumber) + '\n';
298
294
  }
299
295
  }
300
- return true;
296
+ this.value = value;
297
+ }
298
+ equals(other) {
299
+ return this.value === other.value;
300
+ }
301
+ static get NULL() {
302
+ const nullModel = {
303
+ getLineContent: () => '',
304
+ getLineCount: () => 1,
305
+ getLineMaxColumn: () => 1,
306
+ getValueInRange: () => '',
307
+ getValueLengthInRange: () => 0,
308
+ modifyPosition: (position, offset) => position
309
+ };
310
+ return new RichScreenReaderState(nullModel, []);
301
311
  }
302
312
  }
303
313
  class RichPagedScreenReaderStrategy {
@@ -320,7 +330,7 @@ class RichPagedScreenReaderStrategy {
320
330
  if (selectionStartPage + 1 < selectionEndPage) {
321
331
  lineIntervals.push({ startLine: selectionEndPageRange.startLine, endLine: selectionEndPageRange.endLine });
322
332
  }
323
- return new RichScreenReaderState(lineIntervals);
333
+ return new RichScreenReaderState(context, lineIntervals);
324
334
  }
325
335
  }
326
336
  //# sourceMappingURL=screenReaderContentRich.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/native/screenReaderContentRich.ts","vs/editor/browser/controller/editContext/native/screenReaderContentRich.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAE3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAA2E,MAAM,4CAA4C,CAAC;AAC1J,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAoB,eAAe,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AAItH,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACrG,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,MAAM,QAAQ,GAAG,wBAAwB,CAAC,yBAAyB,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;AAErG,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAE1C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAatD,YACkB,QAAkC,EAClC,QAAqB,EACrB,eAA+B,EACzB,qBAA6D;QAEpF,KAAK,EAAE,CAAC;QALS,aAAQ,GAAR,QAAQ,CAA0B;QAClC,aAAQ,GAAR,QAAQ,CAA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AAI,kBAAkB,GAAG,CAAC,GAAG,gBAAgB,EAAE,CAAC;YAC/C,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,SAAS,EAAE,OAAO,EAAE,qBAAqB,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5G,CAAC;QACD,OAAO,IAAI,qBAAqB,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;CACD","file":"screenReaderContentRich.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 { addDisposableListener, getActiveWindow, isHTMLElement } from '../../../../../base/browser/dom.js';\nimport { FastDomNode } from '../../../../../base/browser/fastDomNode.js';\nimport { createTrustedTypesPolicy } from '../../../../../base/browser/trustedTypes.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById, IComputedEditorOptions } from '../../../../common/config/editorOptions.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { StringBuilder } from '../../../../common/core/stringBuilder.js';\nimport { LineDecoration } from '../../../../common/viewLayout/lineDecorations.js';\nimport { CharacterMapping, RenderLineInput, renderViewLine } from '../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewContext } from '../../../../common/viewModel/viewContext.js';\nimport { IPagedScreenReaderStrategy } from '../screenReaderUtils.js';\nimport { ISimpleModel } from '../../../../common/viewModel/screenReaderSimpleModel.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { IME } from '../../../../../base/common/ime.js';\nimport { ViewController } from '../../../view/viewController.js';\nimport { IScreenReaderContent } from './screenReaderUtils.js';\nimport { getColumnOfNodeOffset } from '../../../viewParts/viewLines/viewLine.js';\n\nconst ttPolicy = createTrustedTypesPolicy('richScreenReaderContent', { createHTML: value => value });\n\nconst LINE_NUMBER_ATTRIBUTE = 'data-line-number';\n\nexport class RichScreenReaderContent extends Disposable implements IScreenReaderContent {\n\n\tprivate readonly _selectionChangeListener = this._register(new MutableDisposable());\n\n\tprivate _accessibilityPageSize: number = 1;\n\tprivate _ignoreSelectionChangeTime: number = 0;\n\n\tprivate _state: RichScreenReaderState = new RichScreenReaderState([]);\n\tprivate _strategy: RichPagedScreenReaderStrategy = new RichPagedScreenReaderStrategy();\n\n\tprivate _renderedLines: Map<number, RichRenderedScreenReaderLine> = new Map();\n\tprivate _renderedSelection: Selection = new Selection(1, 1, 1, 1);\n\n\tconstructor(\n\t\tprivate readonly _domNode: FastDomNode<HTMLElement>,\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService\n\t) {\n\t\tsuper();\n\t\tthis.onConfigurationChanged(this._context.configuration.options);\n\t}\n\n\tpublic updateScreenReaderContent(primarySelection: Selection): void {\n\t\tconst focusedElement = getActiveWindow().document.activeElement;\n\t\tif (!focusedElement || focusedElement !== this._domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\tif (isScreenReaderOptimized) {\n\t\t\tconst state = this._getScreenReaderContentLineIntervals(primarySelection);\n\t\t\tif (!this._state.equals(state)) {\n\t\t\t\tthis._state = state;\n\t\t\t\tthis._renderedLines = this._renderScreenReaderContent(state);\n\t\t\t}\n\t\t\tif (!this._renderedSelection.equalsSelection(primarySelection)) {\n\t\t\t\tthis._renderedSelection = primarySelection;\n\t\t\t\tthis._setSelectionOnScreenReaderContent(this._context, this._renderedLines, primarySelection);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._state = new RichScreenReaderState([]);\n\t\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\t\tthis._domNode.domNode.textContent = '';\n\t\t}\n\t}\n\n\tpublic updateScrollTop(primarySelection: Selection): void {\n\t\tconst intervals = this._state.intervals;\n\t\tif (!intervals.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewLayout = this._context.viewModel.viewLayout;\n\t\tconst stateStartLineNumber = intervals[0].startLine;\n\t\tconst verticalOffsetOfStateStartLineNumber = viewLayout.getVerticalOffsetForLineNumber(stateStartLineNumber);\n\t\tconst verticalOffsetOfPositionLineNumber = viewLayout.getVerticalOffsetForLineNumber(primarySelection.positionLineNumber);\n\t\tthis._domNode.domNode.scrollTop = verticalOffsetOfPositionLineNumber - verticalOffsetOfStateStartLineNumber;\n\t}\n\n\tpublic onFocusChange(newFocusValue: boolean): void {\n\t\tif (newFocusValue) {\n\t\t\tthis._selectionChangeListener.value = this._setSelectionChangeListener();\n\t\t} else {\n\t\t\tthis._selectionChangeListener.value = undefined;\n\t\t}\n\t}\n\n\tpublic onConfigurationChanged(options: IComputedEditorOptions): void {\n\t\tthis._accessibilityPageSize = options.get(EditorOption.accessibilityPageSize);\n\t}\n\n\tpublic onWillCut(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onCut');\n\t}\n\n\tpublic onWillPaste(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onWillPaste');\n\t}\n\n\t// --- private methods\n\n\tprivate _setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tprivate _setSelectionChangeListener(): 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 or NVDA for example, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event and needs to be reflected within the editor.\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 addDisposableListener(this._domNode.domNode.ownerDocument, 'selectionchange', () => {\n\t\t\tconst activeElement = getActiveWindow().document.activeElement;\n\t\t\tconst isFocused = activeElement === this._domNode.domNode;\n\t\t\tif (!isFocused) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\t\tif (!isScreenReaderOptimized || !IME.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst now = Date.now();\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\t\t\tconst delta2 = now - this._ignoreSelectionChangeTime;\n\t\t\tthis._ignoreSelectionChangeTime = 0;\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the hidden div\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst selection = this._getEditorSelectionFromDomRange();\n\t\t\tif (!selection) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._viewController.setSelection(selection);\n\t\t});\n\t}\n\n\tprivate _renderScreenReaderContent(state: RichScreenReaderState): Map<number, RichRenderedScreenReaderLine> {\n\t\tconst nodes: HTMLDivElement[] = [];\n\t\tconst renderedLines = new Map<number, RichRenderedScreenReaderLine>();\n\t\tfor (const interval of state.intervals) {\n\t\t\tfor (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {\n\t\t\t\tconst renderedLine = this._renderLine(lineNumber);\n\t\t\t\trenderedLines.set(lineNumber, renderedLine);\n\t\t\t\tnodes.push(renderedLine.domNode);\n\t\t\t}\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\tthis._domNode.domNode.replaceChildren(...nodes);\n\t\treturn renderedLines;\n\t}\n\n\tprivate _renderLine(viewLineNumber: number): RichRenderedScreenReaderLine {\n\t\tconst viewModel = this._context.viewModel;\n\t\tconst positionLineData = viewModel.getViewLineRenderingData(viewLineNumber);\n\t\tconst options = this._context.configuration.options;\n\t\tconst fontInfo = options.get(EditorOption.fontInfo);\n\t\tconst stopRenderingLineAfter = options.get(EditorOption.stopRenderingLineAfter);\n\t\tconst renderControlCharacters = options.get(EditorOption.renderControlCharacters);\n\t\tconst fontLigatures = options.get(EditorOption.fontLigatures);\n\t\tconst disableMonospaceOptimizations = options.get(EditorOption.disableMonospaceOptimizations);\n\t\tconst lineDecorations = LineDecoration.filter(positionLineData.inlineDecorations, viewLineNumber, positionLineData.minColumn, positionLineData.maxColumn);\n\t\tconst useMonospaceOptimizations = fontInfo.isMonospace && !disableMonospaceOptimizations;\n\t\tconst useFontLigatures = fontLigatures !== EditorFontLigatures.OFF;\n\t\tlet renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>;\n\t\tconst experimentalWhitespaceRendering = options.get(EditorOption.experimentalWhitespaceRendering);\n\t\tif (experimentalWhitespaceRendering === 'off') {\n\t\t\trenderWhitespace = options.get(EditorOption.renderWhitespace);\n\t\t} else {\n\t\t\trenderWhitespace = 'none';\n\t\t}\n\t\tconst renderLineInput = new RenderLineInput(\n\t\t\tuseMonospaceOptimizations,\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tpositionLineData.content,\n\t\t\tpositionLineData.continuesWithWrappedLine,\n\t\t\tpositionLineData.isBasicASCII,\n\t\t\tpositionLineData.containsRTL,\n\t\t\tpositionLineData.minColumn - 1,\n\t\t\tpositionLineData.tokens,\n\t\t\tlineDecorations,\n\t\t\tpositionLineData.tabSize,\n\t\t\tpositionLineData.startVisibleColumn,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tuseFontLigatures,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0,\n\t\t\ttrue\n\t\t);\n\t\tconst htmlBuilder = new StringBuilder(10000);\n\t\tconst renderOutput = renderViewLine(renderLineInput, htmlBuilder);\n\t\tconst html = htmlBuilder.build();\n\t\tconst trustedhtml = ttPolicy?.createHTML(html) ?? html;\n\t\tconst lineHeight = viewModel.viewLayout.getLineHeightForLineNumber(viewLineNumber) + 'px';\n\t\tconst domNode = document.createElement('div');\n\t\tdomNode.innerHTML = trustedhtml as string;\n\t\tdomNode.style.lineHeight = lineHeight;\n\t\tdomNode.style.height = lineHeight;\n\t\tdomNode.setAttribute(LINE_NUMBER_ATTRIBUTE, viewLineNumber.toString());\n\t\treturn new RichRenderedScreenReaderLine(domNode, renderOutput.characterMapping);\n\t}\n\n\tprivate _setSelectionOnScreenReaderContent(context: ViewContext, renderedLines: Map<number, RichRenderedScreenReaderLine>, viewSelection: Selection): void {\n\t\tconst activeDocument = getActiveWindow().document;\n\t\tconst activeDocumentSelection = activeDocument.getSelection();\n\t\tif (!activeDocumentSelection) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = viewSelection.startLineNumber;\n\t\tconst endLineNumber = viewSelection.endLineNumber;\n\t\tconst startRenderedLine = renderedLines.get(startLineNumber);\n\t\tconst endRenderedLine = renderedLines.get(endLineNumber);\n\t\tif (!startRenderedLine || !endRenderedLine) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewModel = context.viewModel;\n\t\tconst model = viewModel.model;\n\t\tconst coordinatesConverter = viewModel.coordinatesConverter;\n\t\tconst startRange = new Range(startLineNumber, 1, startLineNumber, viewSelection.selectionStartColumn);\n\t\tconst modelStartRange = coordinatesConverter.convertViewRangeToModelRange(startRange);\n\t\tconst characterCountForStart = model.getCharacterCountInRange(modelStartRange);\n\t\tconst endRange = new Range(endLineNumber, 1, endLineNumber, viewSelection.positionColumn);\n\t\tconst modelEndRange = coordinatesConverter.convertViewRangeToModelRange(endRange);\n\t\tconst characterCountForEnd = model.getCharacterCountInRange(modelEndRange);\n\t\tconst startDomPosition = startRenderedLine.characterMapping.getDomPosition(characterCountForStart);\n\t\tconst endDomPosition = endRenderedLine.characterMapping.getDomPosition(characterCountForEnd);\n\t\tconst startDomNode = startRenderedLine.domNode.firstChild!;\n\t\tconst endDomNode = endRenderedLine.domNode.firstChild!;\n\t\tconst startChildren = startDomNode.childNodes;\n\t\tconst endChildren = endDomNode.childNodes;\n\t\tconst startNode = startChildren.item(startDomPosition.partIndex);\n\t\tconst endNode = endChildren.item(endDomPosition.partIndex);\n\t\tif (!startNode.firstChild || !endNode.firstChild) {\n\t\t\treturn;\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setRange');\n\t\tactiveDocumentSelection.setBaseAndExtent(\n\t\t\tstartNode.firstChild,\n\t\t\tviewSelection.startColumn === 1 ? 0 : startDomPosition.charIndex + 1,\n\t\t\tendNode.firstChild,\n\t\t\tviewSelection.endColumn === 1 ? 0 : endDomPosition.charIndex + 1\n\t\t);\n\t}\n\n\tprivate _getScreenReaderContentLineIntervals(primarySelection: Selection): RichScreenReaderState {\n\t\treturn this._strategy.fromEditorSelection(this._context.viewModel, primarySelection, this._accessibilityPageSize);\n\t}\n\n\tprivate _getEditorSelectionFromDomRange(): Selection | undefined {\n\t\tif (!this._renderedLines) {\n\t\t\treturn;\n\t\t}\n\t\tconst selection = getActiveWindow().document.getSelection();\n\t\tif (!selection) {\n\t\t\treturn;\n\t\t}\n\t\tconst rangeCount = selection.rangeCount;\n\t\tif (rangeCount === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst range = selection.getRangeAt(0);\n\t\tconst startContainer = range.startContainer;\n\t\tconst endContainer = range.endContainer;\n\t\tconst startSpanElement = startContainer.parentElement;\n\t\tconst endSpanElement = endContainer.parentElement;\n\t\tif (!startSpanElement || !isHTMLElement(startSpanElement) || !endSpanElement || !isHTMLElement(endSpanElement)) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineDomNode = startSpanElement.parentElement?.parentElement;\n\t\tconst endLineDomNode = endSpanElement.parentElement?.parentElement;\n\t\tif (!startLineDomNode || !endLineDomNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumberAttribute = startLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tconst endLineNumberAttribute = endLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tif (!startLineNumberAttribute || !endLineNumberAttribute) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = parseInt(startLineNumberAttribute);\n\t\tconst endLineNumber = parseInt(endLineNumberAttribute);\n\t\tconst startMapping = this._renderedLines.get(startLineNumber)?.characterMapping;\n\t\tconst endMapping = this._renderedLines.get(endLineNumber)?.characterMapping;\n\t\tif (!startMapping || !endMapping) {\n\t\t\treturn;\n\t\t}\n\t\tconst startColumn = getColumnOfNodeOffset(startMapping, startSpanElement, range.startOffset);\n\t\tconst endColumn = getColumnOfNodeOffset(endMapping, endSpanElement, range.endOffset);\n\t\tif (selection.direction === 'forward') {\n\t\t\treturn new Selection(\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn,\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn\n\t\t\t);\n\t\t} else {\n\t\t\treturn new Selection(\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn,\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn\n\t\t\t);\n\t\t}\n\t}\n}\n\nclass RichRenderedScreenReaderLine {\n\tconstructor(\n\t\tpublic readonly domNode: HTMLDivElement,\n\t\tpublic readonly characterMapping: CharacterMapping\n\t) { }\n}\n\nclass LineInterval {\n\tconstructor(\n\t\tpublic readonly startLine: number,\n\t\tpublic readonly endLine: number\n\t) { }\n}\n\nclass RichScreenReaderState {\n\n\tconstructor(public readonly intervals: LineInterval[]) { }\n\n\tequals(other: RichScreenReaderState): boolean {\n\t\tif (this.intervals.length !== other.intervals.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < this.intervals.length; i++) {\n\t\t\tif (this.intervals[i].startLine !== other.intervals[i].startLine || this.intervals[i].endLine !== other.intervals[i].endLine) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\nclass RichPagedScreenReaderStrategy implements IPagedScreenReaderStrategy<RichScreenReaderState> {\n\n\tconstructor() { }\n\n\tprivate _getPageOfLine(lineNumber: number, linesPerPage: number): number {\n\t\treturn Math.floor((lineNumber - 1) / linesPerPage);\n\t}\n\n\tprivate _getRangeForPage(context: ISimpleModel, page: number, linesPerPage: number): LineInterval {\n\t\tconst offset = page * linesPerPage;\n\t\tconst startLineNumber = offset + 1;\n\t\tconst endLineNumber = Math.min(offset + linesPerPage, context.getLineCount());\n\t\treturn new LineInterval(startLineNumber, endLineNumber);\n\t}\n\n\tpublic fromEditorSelection(context: ISimpleModel, viewSelection: Selection, linesPerPage: number): RichScreenReaderState {\n\t\tconst selectionStartPage = this._getPageOfLine(viewSelection.startLineNumber, linesPerPage);\n\t\tconst selectionStartPageRange = this._getRangeForPage(context, selectionStartPage, linesPerPage);\n\t\tconst selectionEndPage = this._getPageOfLine(viewSelection.endLineNumber, linesPerPage);\n\t\tconst selectionEndPageRange = this._getRangeForPage(context, selectionEndPage, linesPerPage);\n\t\tconst lineIntervals: LineInterval[] = [{ startLine: selectionStartPageRange.startLine, endLine: selectionStartPageRange.endLine }];\n\t\tif (selectionStartPage + 1 < selectionEndPage) {\n\t\t\tlineIntervals.push({ startLine: selectionEndPageRange.startLine, endLine: selectionEndPageRange.endLine });\n\t\t}\n\t\treturn new RichScreenReaderState(lineIntervals);\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 { addDisposableListener, getActiveWindow, isHTMLElement } from '../../../../../base/browser/dom.js';\nimport { FastDomNode } from '../../../../../base/browser/fastDomNode.js';\nimport { createTrustedTypesPolicy } from '../../../../../base/browser/trustedTypes.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById, IComputedEditorOptions } from '../../../../common/config/editorOptions.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { StringBuilder } from '../../../../common/core/stringBuilder.js';\nimport { LineDecoration } from '../../../../common/viewLayout/lineDecorations.js';\nimport { CharacterMapping, RenderLineInput, renderViewLine } from '../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewContext } from '../../../../common/viewModel/viewContext.js';\nimport { IPagedScreenReaderStrategy } from '../screenReaderUtils.js';\nimport { ISimpleModel } from '../../../../common/viewModel/screenReaderSimpleModel.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { IME } from '../../../../../base/common/ime.js';\nimport { ViewController } from '../../../view/viewController.js';\nimport { IScreenReaderContent } from './screenReaderUtils.js';\nimport { getColumnOfNodeOffset } from '../../../viewParts/viewLines/viewLine.js';\n\nconst ttPolicy = createTrustedTypesPolicy('richScreenReaderContent', { createHTML: value => value });\n\nconst LINE_NUMBER_ATTRIBUTE = 'data-line-number';\n\nexport class RichScreenReaderContent extends Disposable implements IScreenReaderContent {\n\n\tprivate readonly _selectionChangeListener = this._register(new MutableDisposable());\n\n\tprivate _accessibilityPageSize: number = 1;\n\tprivate _ignoreSelectionChangeTime: number = 0;\n\n\tprivate _state: RichScreenReaderState = new RichScreenReaderState([]);\n\tprivate _strategy: RichPagedScreenReaderStrategy = new RichPagedScreenReaderStrategy();\n\n\tprivate _renderedLines: Map<number, RichRenderedScreenReaderLine> = new Map();\n\tprivate _renderedSelection: Selection = new Selection(1, 1, 1, 1);\n\n\tconstructor(\n\t\tprivate readonly _domNode: FastDomNode<HTMLElement>,\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService\n\t) {\n\t\tsuper();\n\t\tthis.onConfigurationChanged(this._context.configuration.options);\n\t}\n\n\tpublic updateScreenReaderContent(primarySelection: Selection): void {\n\t\tconst focusedElement = getActiveWindow().document.activeElement;\n\t\tif (!focusedElement || focusedElement !== this._domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\tif (isScreenReaderOptimized) {\n\t\t\tconst state = this._getScreenReaderContentLineIntervals(primarySelection);\n\t\t\tif (!this._state.equals(state)) {\n\t\t\t\tthis._state = state;\n\t\t\t\tthis._renderedLines = this._renderScreenReaderContent(state);\n\t\t\t}\n\t\t\tif (!this._renderedSelection.equalsSelection(primarySelection)) {\n\t\t\t\tthis._renderedSelection = primarySelection;\n\t\t\t\tthis._setSelectionOnScreenReaderContent(this._context, this._renderedLines, primarySelection);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._state = new RichScreenReaderState([]);\n\t\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\t\tthis._domNode.domNode.textContent = '';\n\t\t}\n\t}\n\n\tpublic updateScrollTop(primarySelection: Selection): void {\n\t\tconst intervals = this._state.intervals;\n\t\tif (!intervals.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewLayout = this._context.viewModel.viewLayout;\n\t\tconst stateStartLineNumber = intervals[0].startLine;\n\t\tconst verticalOffsetOfStateStartLineNumber = viewLayout.getVerticalOffsetForLineNumber(stateStartLineNumber);\n\t\tconst verticalOffsetOfPositionLineNumber = viewLayout.getVerticalOffsetForLineNumber(primarySelection.positionLineNumber);\n\t\tthis._domNode.domNode.scrollTop = verticalOffsetOfPositionLineNumber - verticalOffsetOfStateStartLineNumber;\n\t}\n\n\tpublic onFocusChange(newFocusValue: boolean): void {\n\t\tif (newFocusValue) {\n\t\t\tthis._selectionChangeListener.value = this._setSelectionChangeListener();\n\t\t} else {\n\t\t\tthis._selectionChangeListener.value = undefined;\n\t\t}\n\t}\n\n\tpublic onConfigurationChanged(options: IComputedEditorOptions): void {\n\t\tthis._accessibilityPageSize = options.get(EditorOption.accessibilityPageSize);\n\t}\n\n\tpublic onWillCut(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onCut');\n\t}\n\n\tpublic onWillPaste(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onWillPaste');\n\t}\n\n\t// --- private methods\n\n\tprivate _setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tprivate _setSelectionChangeListener(): 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 or NVDA for example, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event and needs to be reflected within the editor.\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 addDisposableListener(this._domNode.domNode.ownerDocument, 'selectionchange', () => {\n\t\t\tconst activeElement = getActiveWindow().document.activeElement;\n\t\t\tconst isFocused = activeElement === this._domNode.domNode;\n\t\t\tif (!isFocused) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\t\tif (!isScreenReaderOptimized || !IME.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst now = Date.now();\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\t\t\tconst delta2 = now - this._ignoreSelectionChangeTime;\n\t\t\tthis._ignoreSelectionChangeTime = 0;\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the hidden div\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst selection = this._getEditorSelectionFromDomRange();\n\t\t\tif (!selection) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._viewController.setSelection(selection);\n\t\t});\n\t}\n\n\tprivate _renderScreenReaderContent(state: RichScreenReaderState): Map<number, RichRenderedScreenReaderLine> {\n\t\tconst nodes: HTMLDivElement[] = [];\n\t\tconst renderedLines = new Map<number, RichRenderedScreenReaderLine>();\n\t\tfor (const interval of state.intervals) {\n\t\t\tfor (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {\n\t\t\t\tconst renderedLine = this._renderLine(lineNumber);\n\t\t\t\trenderedLines.set(lineNumber, renderedLine);\n\t\t\t\tnodes.push(renderedLine.domNode);\n\t\t\t}\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\tthis._domNode.domNode.replaceChildren(...nodes);\n\t\treturn renderedLines;\n\t}\n\n\tprivate _renderLine(viewLineNumber: number): RichRenderedScreenReaderLine {\n\t\tconst viewModel = this._context.viewModel;\n\t\tconst positionLineData = viewModel.getViewLineRenderingData(viewLineNumber);\n\t\tconst options = this._context.configuration.options;\n\t\tconst fontInfo = options.get(EditorOption.fontInfo);\n\t\tconst stopRenderingLineAfter = options.get(EditorOption.stopRenderingLineAfter);\n\t\tconst renderControlCharacters = options.get(EditorOption.renderControlCharacters);\n\t\tconst fontLigatures = options.get(EditorOption.fontLigatures);\n\t\tconst disableMonospaceOptimizations = options.get(EditorOption.disableMonospaceOptimizations);\n\t\tconst lineDecorations = LineDecoration.filter(positionLineData.inlineDecorations, viewLineNumber, positionLineData.minColumn, positionLineData.maxColumn);\n\t\tconst useMonospaceOptimizations = fontInfo.isMonospace && !disableMonospaceOptimizations;\n\t\tconst useFontLigatures = fontLigatures !== EditorFontLigatures.OFF;\n\t\tlet renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>;\n\t\tconst experimentalWhitespaceRendering = options.get(EditorOption.experimentalWhitespaceRendering);\n\t\tif (experimentalWhitespaceRendering === 'off') {\n\t\t\trenderWhitespace = options.get(EditorOption.renderWhitespace);\n\t\t} else {\n\t\t\trenderWhitespace = 'none';\n\t\t}\n\t\tconst renderLineInput = new RenderLineInput(\n\t\t\tuseMonospaceOptimizations,\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tpositionLineData.content,\n\t\t\tpositionLineData.continuesWithWrappedLine,\n\t\t\tpositionLineData.isBasicASCII,\n\t\t\tpositionLineData.containsRTL,\n\t\t\tpositionLineData.minColumn - 1,\n\t\t\tpositionLineData.tokens,\n\t\t\tlineDecorations,\n\t\t\tpositionLineData.tabSize,\n\t\t\tpositionLineData.startVisibleColumn,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tuseFontLigatures,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0,\n\t\t\ttrue\n\t\t);\n\t\tconst htmlBuilder = new StringBuilder(10000);\n\t\tconst renderOutput = renderViewLine(renderLineInput, htmlBuilder);\n\t\tconst html = htmlBuilder.build();\n\t\tconst trustedhtml = ttPolicy?.createHTML(html) ?? html;\n\t\tconst lineHeight = viewModel.viewLayout.getLineHeightForLineNumber(viewLineNumber) + 'px';\n\t\tconst domNode = document.createElement('div');\n\t\tdomNode.innerHTML = trustedhtml as string;\n\t\tdomNode.style.lineHeight = lineHeight;\n\t\tdomNode.style.height = lineHeight;\n\t\tdomNode.setAttribute(LINE_NUMBER_ATTRIBUTE, viewLineNumber.toString());\n\t\treturn new RichRenderedScreenReaderLine(domNode, renderOutput.characterMapping);\n\t}\n\n\tprivate _setSelectionOnScreenReaderContent(context: ViewContext, renderedLines: Map<number, RichRenderedScreenReaderLine>, viewSelection: Selection): void {\n\t\tconst activeDocument = getActiveWindow().document;\n\t\tconst activeDocumentSelection = activeDocument.getSelection();\n\t\tif (!activeDocumentSelection) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = viewSelection.startLineNumber;\n\t\tconst endLineNumber = viewSelection.endLineNumber;\n\t\tconst startRenderedLine = renderedLines.get(startLineNumber);\n\t\tconst endRenderedLine = renderedLines.get(endLineNumber);\n\t\tif (!startRenderedLine || !endRenderedLine) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewModel = context.viewModel;\n\t\tconst model = viewModel.model;\n\t\tconst coordinatesConverter = viewModel.coordinatesConverter;\n\t\tconst startRange = new Range(startLineNumber, 1, startLineNumber, viewSelection.selectionStartColumn);\n\t\tconst modelStartRange = coordinatesConverter.convertViewRangeToModelRange(startRange);\n\t\tconst characterCountForStart = model.getCharacterCountInRange(modelStartRange);\n\t\tconst endRange = new Range(endLineNumber, 1, endLineNumber, viewSelection.positionColumn);\n\t\tconst modelEndRange = coordinatesConverter.convertViewRangeToModelRange(endRange);\n\t\tconst characterCountForEnd = model.getCharacterCountInRange(modelEndRange);\n\t\tconst startDomPosition = startRenderedLine.characterMapping.getDomPosition(characterCountForStart);\n\t\tconst endDomPosition = endRenderedLine.characterMapping.getDomPosition(characterCountForEnd);\n\t\tconst startDomNode = startRenderedLine.domNode.firstChild!;\n\t\tconst endDomNode = endRenderedLine.domNode.firstChild!;\n\t\tconst startChildren = startDomNode.childNodes;\n\t\tconst endChildren = endDomNode.childNodes;\n\t\tconst startNode = startChildren.item(startDomPosition.partIndex);\n\t\tconst endNode = endChildren.item(endDomPosition.partIndex);\n\t\tif (!startNode.firstChild || !endNode.firstChild) {\n\t\t\treturn;\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setRange');\n\t\tactiveDocumentSelection.setBaseAndExtent(\n\t\t\tstartNode.firstChild,\n\t\t\tviewSelection.startColumn === 1 ? 0 : startDomPosition.charIndex + 1,\n\t\t\tendNode.firstChild,\n\t\t\tviewSelection.endColumn === 1 ? 0 : endDomPosition.charIndex + 1\n\t\t);\n\t}\n\n\tprivate _getScreenReaderContentLineIntervals(primarySelection: Selection): RichScreenReaderState {\n\t\treturn this._strategy.fromEditorSelection(this._context.viewModel, primarySelection, this._accessibilityPageSize);\n\t}\n\n\tprivate _getEditorSelectionFromDomRange(): Selection | undefined {\n\t\tif (!this._renderedLines) {\n\t\t\treturn;\n\t\t}\n\t\tconst selection = getActiveWindow().document.getSelection();\n\t\tif (!selection) {\n\t\t\treturn;\n\t\t}\n\t\tconst rangeCount = selection.rangeCount;\n\t\tif (rangeCount === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst range = selection.getRangeAt(0);\n\t\tconst startContainer = range.startContainer;\n\t\tconst endContainer = range.endContainer;\n\t\tconst startSpanElement = startContainer.parentElement;\n\t\tconst endSpanElement = endContainer.parentElement;\n\t\tif (!startSpanElement || !isHTMLElement(startSpanElement) || !endSpanElement || !isHTMLElement(endSpanElement)) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineDomNode = startSpanElement.parentElement?.parentElement;\n\t\tconst endLineDomNode = endSpanElement.parentElement?.parentElement;\n\t\tif (!startLineDomNode || !endLineDomNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumberAttribute = startLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tconst endLineNumberAttribute = endLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tif (!startLineNumberAttribute || !endLineNumberAttribute) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = parseInt(startLineNumberAttribute);\n\t\tconst endLineNumber = parseInt(endLineNumberAttribute);\n\t\tconst startMapping = this._renderedLines.get(startLineNumber)?.characterMapping;\n\t\tconst endMapping = this._renderedLines.get(endLineNumber)?.characterMapping;\n\t\tif (!startMapping || !endMapping) {\n\t\t\treturn;\n\t\t}\n\t\tconst startColumn = getColumnOfNodeOffset(startMapping, startSpanElement, range.startOffset);\n\t\tconst endColumn = getColumnOfNodeOffset(endMapping, endSpanElement, range.endOffset);\n\t\tif (selection.direction === 'forward') {\n\t\t\treturn new Selection(\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn,\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn\n\t\t\t);\n\t\t} else {\n\t\t\treturn new Selection(\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn,\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn\n\t\t\t);\n\t\t}\n\t}\n}\n\nclass RichRenderedScreenReaderLine {\n\tconstructor(\n\t\tpublic readonly domNode: HTMLDivElement,\n\t\tpublic readonly characterMapping: CharacterMapping\n\t) { }\n}\n\nclass LineInterval {\n\tconstructor(\n\t\tpublic readonly startLine: number,\n\t\tpublic readonly endLine: number\n\t) { }\n}\n\nclass RichScreenReaderState {\n\n\tconstructor(public readonly intervals: LineInterval[]) { }\n\n\tequals(other: RichScreenReaderState): boolean {\n\t\tif (this.intervals.length !== other.intervals.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < this.intervals.length; i++) {\n\t\t\tif (this.intervals[i].startLine !== other.intervals[i].startLine || this.intervals[i].endLine !== other.intervals[i].endLine) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\nclass RichPagedScreenReaderStrategy implements IPagedScreenReaderStrategy<RichScreenReaderState> {\n\n\tconstructor() { }\n\n\tprivate _getPageOfLine(lineNumber: number, linesPerPage: number): number {\n\t\treturn Math.floor((lineNumber - 1) / linesPerPage);\n\t}\n\n\tprivate _getRangeForPage(context: ISimpleModel, page: number, linesPerPage: number): LineInterval {\n\t\tconst offset = page * linesPerPage;\n\t\tconst startLineNumber = offset + 1;\n\t\tconst endLineNumber = Math.min(offset + linesPerPage, context.getLineCount());\n\t\treturn new LineInterval(startLineNumber, endLineNumber);\n\t}\n\n\tpublic fromEditorSelection(context: ISimpleModel, viewSelection: Selection, linesPerPage: number): RichScreenReaderState {\n\t\tconst selectionStartPage = this._getPageOfLine(viewSelection.startLineNumber, linesPerPage);\n\t\tconst selectionStartPageRange = this._getRangeForPage(context, selectionStartPage, linesPerPage);\n\t\tconst selectionEndPage = this._getPageOfLine(viewSelection.endLineNumber, linesPerPage);\n\t\tconst selectionEndPageRange = this._getRangeForPage(context, selectionEndPage, linesPerPage);\n\t\tconst lineIntervals: LineInterval[] = [{ startLine: selectionStartPageRange.startLine, endLine: selectionStartPageRange.endLine }];\n\t\tif (selectionStartPage + 1 < selectionEndPage) {\n\t\t\tlineIntervals.push({ startLine: selectionEndPageRange.startLine, endLine: selectionEndPageRange.endLine });\n\t\t}\n\t\treturn new RichScreenReaderState(lineIntervals);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/native/screenReaderContentRich.ts","vs/editor/browser/controller/editContext/native/screenReaderContentRich.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAE3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAA2E,MAAM,4CAA4C,CAAC;AAC1J,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAoB,eAAe,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AAItH,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACrG,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AAGxD,OAAO,EAAE,q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AAE,CAAC,CAAC;QAC9E,OAAO,IAAI,YAAY,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IACzD,CAAC;IAEM,mBAAmB,CAAC,OAAqB,EAAE,aAAwB,EAAE,YAAoB;QAC/F,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QAC5F,MAAM,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAC;QACjG,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;QACxF,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAC7F,MAAM,aAAa,GAAmB,CAAC,EAAE,SAAS,EAAE,uBAAuB,CAAC,SAAS,EAAE,OAAO,EAAE,uBAAuB,CAAC,OAAO,EAAE,CAAC,CAAC;QACnI,IAAI,kBAAkB,GAAG,CAAC,GAAG,gBAAgB,EAAE,CAAC;YAC/C,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,SAAS,EAAE,OAAO,EAAE,qBAAqB,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5G,CAAC;QACD,OAAO,IAAI,qBAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;CACD","file":"screenReaderContentRich.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 { addDisposableListener, getActiveWindow, isHTMLElement } from '../../../../../base/browser/dom.js';\nimport { FastDomNode } from '../../../../../base/browser/fastDomNode.js';\nimport { createTrustedTypesPolicy } from '../../../../../base/browser/trustedTypes.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById, IComputedEditorOptions } from '../../../../common/config/editorOptions.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { StringBuilder } from '../../../../common/core/stringBuilder.js';\nimport { LineDecoration } from '../../../../common/viewLayout/lineDecorations.js';\nimport { CharacterMapping, RenderLineInput, renderViewLine } from '../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewContext } from '../../../../common/viewModel/viewContext.js';\nimport { IPagedScreenReaderStrategy } from '../screenReaderUtils.js';\nimport { ISimpleModel } from '../../../../common/viewModel/screenReaderSimpleModel.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { IME } from '../../../../../base/common/ime.js';\nimport { ViewController } from '../../../view/viewController.js';\nimport { IScreenReaderContent } from './screenReaderUtils.js';\nimport { getColumnOfNodeOffset } from '../../../viewParts/viewLines/viewLine.js';\n\nconst ttPolicy = createTrustedTypesPolicy('richScreenReaderContent', { createHTML: value => value });\n\nconst LINE_NUMBER_ATTRIBUTE = 'data-line-number';\n\nexport class RichScreenReaderContent extends Disposable implements IScreenReaderContent {\n\n\tprivate readonly _selectionChangeListener = this._register(new MutableDisposable());\n\n\tprivate _accessibilityPageSize: number = 1;\n\tprivate _ignoreSelectionChangeTime: number = 0;\n\n\tprivate _state: RichScreenReaderState = RichScreenReaderState.NULL;\n\tprivate _strategy: RichPagedScreenReaderStrategy = new RichPagedScreenReaderStrategy();\n\n\tprivate _renderedLines: Map<number, RichRenderedScreenReaderLine> = new Map();\n\tprivate _renderedSelection: Selection = new Selection(1, 1, 1, 1);\n\n\tconstructor(\n\t\tprivate readonly _domNode: FastDomNode<HTMLElement>,\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService\n\t) {\n\t\tsuper();\n\t\tthis.onConfigurationChanged(this._context.configuration.options);\n\t}\n\n\tpublic updateScreenReaderContent(primarySelection: Selection): void {\n\t\tconst focusedElement = getActiveWindow().document.activeElement;\n\t\tif (!focusedElement || focusedElement !== this._domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\tif (isScreenReaderOptimized) {\n\t\t\tconst state = this._getScreenReaderContentLineIntervals(primarySelection);\n\t\t\tif (!this._state.equals(state)) {\n\t\t\t\tthis._state = state;\n\t\t\t\tthis._renderedLines = this._renderScreenReaderContent(state);\n\t\t\t}\n\t\t\tif (!this._renderedSelection.equalsSelection(primarySelection)) {\n\t\t\t\tthis._renderedSelection = primarySelection;\n\t\t\t\tthis._setSelectionOnScreenReaderContent(this._context, this._renderedLines, primarySelection);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._state = RichScreenReaderState.NULL;\n\t\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\t\tthis._domNode.domNode.textContent = '';\n\t\t}\n\t}\n\n\tpublic updateScrollTop(primarySelection: Selection): void {\n\t\tconst intervals = this._state.intervals;\n\t\tif (!intervals.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewLayout = this._context.viewModel.viewLayout;\n\t\tconst stateStartLineNumber = intervals[0].startLine;\n\t\tconst verticalOffsetOfStateStartLineNumber = viewLayout.getVerticalOffsetForLineNumber(stateStartLineNumber);\n\t\tconst verticalOffsetOfPositionLineNumber = viewLayout.getVerticalOffsetForLineNumber(primarySelection.positionLineNumber);\n\t\tthis._domNode.domNode.scrollTop = verticalOffsetOfPositionLineNumber - verticalOffsetOfStateStartLineNumber;\n\t}\n\n\tpublic onFocusChange(newFocusValue: boolean): void {\n\t\tif (newFocusValue) {\n\t\t\tthis._selectionChangeListener.value = this._setSelectionChangeListener();\n\t\t} else {\n\t\t\tthis._selectionChangeListener.value = undefined;\n\t\t}\n\t}\n\n\tpublic onConfigurationChanged(options: IComputedEditorOptions): void {\n\t\tthis._accessibilityPageSize = options.get(EditorOption.accessibilityPageSize);\n\t}\n\n\tpublic onWillCut(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onCut');\n\t}\n\n\tpublic onWillPaste(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onWillPaste');\n\t}\n\n\t// --- private methods\n\n\tprivate _setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tprivate _setSelectionChangeListener(): 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 or NVDA for example, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event and needs to be reflected within the editor.\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 addDisposableListener(this._domNode.domNode.ownerDocument, 'selectionchange', () => {\n\t\t\tconst activeElement = getActiveWindow().document.activeElement;\n\t\t\tconst isFocused = activeElement === this._domNode.domNode;\n\t\t\tif (!isFocused) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\t\tif (!isScreenReaderOptimized || !IME.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst now = Date.now();\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\t\t\tconst delta2 = now - this._ignoreSelectionChangeTime;\n\t\t\tthis._ignoreSelectionChangeTime = 0;\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the hidden div\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst selection = this._getEditorSelectionFromDomRange();\n\t\t\tif (!selection) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._viewController.setSelection(selection);\n\t\t});\n\t}\n\n\tprivate _renderScreenReaderContent(state: RichScreenReaderState): Map<number, RichRenderedScreenReaderLine> {\n\t\tconst nodes: HTMLDivElement[] = [];\n\t\tconst renderedLines = new Map<number, RichRenderedScreenReaderLine>();\n\t\tfor (const interval of state.intervals) {\n\t\t\tfor (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {\n\t\t\t\tconst renderedLine = this._renderLine(lineNumber);\n\t\t\t\trenderedLines.set(lineNumber, renderedLine);\n\t\t\t\tnodes.push(renderedLine.domNode);\n\t\t\t}\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\tthis._domNode.domNode.replaceChildren(...nodes);\n\t\treturn renderedLines;\n\t}\n\n\tprivate _renderLine(viewLineNumber: number): RichRenderedScreenReaderLine {\n\t\tconst viewModel = this._context.viewModel;\n\t\tconst positionLineData = viewModel.getViewLineRenderingData(viewLineNumber);\n\t\tconst options = this._context.configuration.options;\n\t\tconst fontInfo = options.get(EditorOption.fontInfo);\n\t\tconst stopRenderingLineAfter = options.get(EditorOption.stopRenderingLineAfter);\n\t\tconst renderControlCharacters = options.get(EditorOption.renderControlCharacters);\n\t\tconst fontLigatures = options.get(EditorOption.fontLigatures);\n\t\tconst disableMonospaceOptimizations = options.get(EditorOption.disableMonospaceOptimizations);\n\t\tconst lineDecorations = LineDecoration.filter(positionLineData.inlineDecorations, viewLineNumber, positionLineData.minColumn, positionLineData.maxColumn);\n\t\tconst useMonospaceOptimizations = fontInfo.isMonospace && !disableMonospaceOptimizations;\n\t\tconst useFontLigatures = fontLigatures !== EditorFontLigatures.OFF;\n\t\tlet renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>;\n\t\tconst experimentalWhitespaceRendering = options.get(EditorOption.experimentalWhitespaceRendering);\n\t\tif (experimentalWhitespaceRendering === 'off') {\n\t\t\trenderWhitespace = options.get(EditorOption.renderWhitespace);\n\t\t} else {\n\t\t\trenderWhitespace = 'none';\n\t\t}\n\t\tconst renderLineInput = new RenderLineInput(\n\t\t\tuseMonospaceOptimizations,\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tpositionLineData.content,\n\t\t\tpositionLineData.continuesWithWrappedLine,\n\t\t\tpositionLineData.isBasicASCII,\n\t\t\tpositionLineData.containsRTL,\n\t\t\tpositionLineData.minColumn - 1,\n\t\t\tpositionLineData.tokens,\n\t\t\tlineDecorations,\n\t\t\tpositionLineData.tabSize,\n\t\t\tpositionLineData.startVisibleColumn,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tuseFontLigatures,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0,\n\t\t\ttrue\n\t\t);\n\t\tconst htmlBuilder = new StringBuilder(10000);\n\t\tconst renderOutput = renderViewLine(renderLineInput, htmlBuilder);\n\t\tconst html = htmlBuilder.build();\n\t\tconst trustedhtml = ttPolicy?.createHTML(html) ?? html;\n\t\tconst lineHeight = viewModel.viewLayout.getLineHeightForLineNumber(viewLineNumber) + 'px';\n\t\tconst domNode = document.createElement('div');\n\t\tdomNode.innerHTML = trustedhtml as string;\n\t\tdomNode.style.lineHeight = lineHeight;\n\t\tdomNode.style.height = lineHeight;\n\t\tdomNode.setAttribute(LINE_NUMBER_ATTRIBUTE, viewLineNumber.toString());\n\t\treturn new RichRenderedScreenReaderLine(domNode, renderOutput.characterMapping);\n\t}\n\n\tprivate _setSelectionOnScreenReaderContent(context: ViewContext, renderedLines: Map<number, RichRenderedScreenReaderLine>, viewSelection: Selection): void {\n\t\tconst activeDocument = getActiveWindow().document;\n\t\tconst activeDocumentSelection = activeDocument.getSelection();\n\t\tif (!activeDocumentSelection) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = viewSelection.startLineNumber;\n\t\tconst endLineNumber = viewSelection.endLineNumber;\n\t\tconst startRenderedLine = renderedLines.get(startLineNumber);\n\t\tconst endRenderedLine = renderedLines.get(endLineNumber);\n\t\tif (!startRenderedLine || !endRenderedLine) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewModel = context.viewModel;\n\t\tconst model = viewModel.model;\n\t\tconst coordinatesConverter = viewModel.coordinatesConverter;\n\t\tconst startRange = new Range(startLineNumber, 1, startLineNumber, viewSelection.selectionStartColumn);\n\t\tconst modelStartRange = coordinatesConverter.convertViewRangeToModelRange(startRange);\n\t\tconst characterCountForStart = model.getCharacterCountInRange(modelStartRange);\n\t\tconst endRange = new Range(endLineNumber, 1, endLineNumber, viewSelection.positionColumn);\n\t\tconst modelEndRange = coordinatesConverter.convertViewRangeToModelRange(endRange);\n\t\tconst characterCountForEnd = model.getCharacterCountInRange(modelEndRange);\n\t\tconst startDomPosition = startRenderedLine.characterMapping.getDomPosition(characterCountForStart);\n\t\tconst endDomPosition = endRenderedLine.characterMapping.getDomPosition(characterCountForEnd);\n\t\tconst startDomNode = startRenderedLine.domNode.firstChild!;\n\t\tconst endDomNode = endRenderedLine.domNode.firstChild!;\n\t\tconst startChildren = startDomNode.childNodes;\n\t\tconst endChildren = endDomNode.childNodes;\n\t\tconst startNode = startChildren.item(startDomPosition.partIndex);\n\t\tconst endNode = endChildren.item(endDomPosition.partIndex);\n\t\tif (!startNode.firstChild || !endNode.firstChild) {\n\t\t\treturn;\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setRange');\n\t\tactiveDocumentSelection.setBaseAndExtent(\n\t\t\tstartNode.firstChild,\n\t\t\tviewSelection.startColumn === 1 ? 0 : startDomPosition.charIndex + 1,\n\t\t\tendNode.firstChild,\n\t\t\tviewSelection.endColumn === 1 ? 0 : endDomPosition.charIndex + 1\n\t\t);\n\t}\n\n\tprivate _getScreenReaderContentLineIntervals(primarySelection: Selection): RichScreenReaderState {\n\t\treturn this._strategy.fromEditorSelection(this._context.viewModel, primarySelection, this._accessibilityPageSize);\n\t}\n\n\tprivate _getEditorSelectionFromDomRange(): Selection | undefined {\n\t\tif (!this._renderedLines) {\n\t\t\treturn;\n\t\t}\n\t\tconst selection = getActiveWindow().document.getSelection();\n\t\tif (!selection) {\n\t\t\treturn;\n\t\t}\n\t\tconst rangeCount = selection.rangeCount;\n\t\tif (rangeCount === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst range = selection.getRangeAt(0);\n\t\tconst startContainer = range.startContainer;\n\t\tconst endContainer = range.endContainer;\n\t\tconst startSpanElement = startContainer.parentElement;\n\t\tconst endSpanElement = endContainer.parentElement;\n\t\tif (!startSpanElement || !isHTMLElement(startSpanElement) || !endSpanElement || !isHTMLElement(endSpanElement)) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineDomNode = startSpanElement.parentElement?.parentElement;\n\t\tconst endLineDomNode = endSpanElement.parentElement?.parentElement;\n\t\tif (!startLineDomNode || !endLineDomNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumberAttribute = startLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tconst endLineNumberAttribute = endLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tif (!startLineNumberAttribute || !endLineNumberAttribute) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = parseInt(startLineNumberAttribute);\n\t\tconst endLineNumber = parseInt(endLineNumberAttribute);\n\t\tconst startMapping = this._renderedLines.get(startLineNumber)?.characterMapping;\n\t\tconst endMapping = this._renderedLines.get(endLineNumber)?.characterMapping;\n\t\tif (!startMapping || !endMapping) {\n\t\t\treturn;\n\t\t}\n\t\tconst startColumn = getColumnOfNodeOffset(startMapping, startSpanElement, range.startOffset);\n\t\tconst endColumn = getColumnOfNodeOffset(endMapping, endSpanElement, range.endOffset);\n\t\tif (selection.direction === 'forward') {\n\t\t\treturn new Selection(\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn,\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn\n\t\t\t);\n\t\t} else {\n\t\t\treturn new Selection(\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn,\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn\n\t\t\t);\n\t\t}\n\t}\n}\n\nclass RichRenderedScreenReaderLine {\n\tconstructor(\n\t\tpublic readonly domNode: HTMLDivElement,\n\t\tpublic readonly characterMapping: CharacterMapping\n\t) { }\n}\n\nclass LineInterval {\n\tconstructor(\n\t\tpublic readonly startLine: number,\n\t\tpublic readonly endLine: number\n\t) { }\n}\n\nclass RichScreenReaderState {\n\n\tpublic readonly value: string;\n\n\tconstructor(model: ISimpleModel, public readonly intervals: LineInterval[]) {\n\t\tlet value = '';\n\t\tfor (const interval of intervals) {\n\t\t\tfor (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {\n\t\t\t\tvalue += model.getLineContent(lineNumber) + '\\n';\n\t\t\t}\n\t\t}\n\t\tthis.value = value;\n\t}\n\n\tequals(other: RichScreenReaderState): boolean {\n\t\treturn this.value === other.value;\n\t}\n\n\tstatic get NULL(): RichScreenReaderState {\n\t\tconst nullModel: ISimpleModel = {\n\t\t\tgetLineContent: () => '',\n\t\t\tgetLineCount: () => 1,\n\t\t\tgetLineMaxColumn: () => 1,\n\t\t\tgetValueInRange: () => '',\n\t\t\tgetValueLengthInRange: () => 0,\n\t\t\tmodifyPosition: (position, offset) => position\n\t\t};\n\t\treturn new RichScreenReaderState(nullModel, []);\n\t}\n}\n\nclass RichPagedScreenReaderStrategy implements IPagedScreenReaderStrategy<RichScreenReaderState> {\n\n\tconstructor() { }\n\n\tprivate _getPageOfLine(lineNumber: number, linesPerPage: number): number {\n\t\treturn Math.floor((lineNumber - 1) / linesPerPage);\n\t}\n\n\tprivate _getRangeForPage(context: ISimpleModel, page: number, linesPerPage: number): LineInterval {\n\t\tconst offset = page * linesPerPage;\n\t\tconst startLineNumber = offset + 1;\n\t\tconst endLineNumber = Math.min(offset + linesPerPage, context.getLineCount());\n\t\treturn new LineInterval(startLineNumber, endLineNumber);\n\t}\n\n\tpublic fromEditorSelection(context: ISimpleModel, viewSelection: Selection, linesPerPage: number): RichScreenReaderState {\n\t\tconst selectionStartPage = this._getPageOfLine(viewSelection.startLineNumber, linesPerPage);\n\t\tconst selectionStartPageRange = this._getRangeForPage(context, selectionStartPage, linesPerPage);\n\t\tconst selectionEndPage = this._getPageOfLine(viewSelection.endLineNumber, linesPerPage);\n\t\tconst selectionEndPageRange = this._getRangeForPage(context, selectionEndPage, linesPerPage);\n\t\tconst lineIntervals: LineInterval[] = [{ startLine: selectionStartPageRange.startLine, endLine: selectionStartPageRange.endLine }];\n\t\tif (selectionStartPage + 1 < selectionEndPage) {\n\t\t\tlineIntervals.push({ startLine: selectionEndPageRange.startLine, endLine: selectionEndPageRange.endLine });\n\t\t}\n\t\treturn new RichScreenReaderState(context, lineIntervals);\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 { addDisposableListener, getActiveWindow, isHTMLElement } from '../../../../../base/browser/dom.js';\nimport { FastDomNode } from '../../../../../base/browser/fastDomNode.js';\nimport { createTrustedTypesPolicy } from '../../../../../base/browser/trustedTypes.js';\nimport { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById, IComputedEditorOptions } from '../../../../common/config/editorOptions.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { Selection } from '../../../../common/core/selection.js';\nimport { StringBuilder } from '../../../../common/core/stringBuilder.js';\nimport { LineDecoration } from '../../../../common/viewLayout/lineDecorations.js';\nimport { CharacterMapping, RenderLineInput, renderViewLine } from '../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewContext } from '../../../../common/viewModel/viewContext.js';\nimport { IPagedScreenReaderStrategy } from '../screenReaderUtils.js';\nimport { ISimpleModel } from '../../../../common/viewModel/screenReaderSimpleModel.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../../../base/common/lifecycle.js';\nimport { IME } from '../../../../../base/common/ime.js';\nimport { ViewController } from '../../../view/viewController.js';\nimport { IScreenReaderContent } from './screenReaderUtils.js';\nimport { getColumnOfNodeOffset } from '../../../viewParts/viewLines/viewLine.js';\n\nconst ttPolicy = createTrustedTypesPolicy('richScreenReaderContent', { createHTML: value => value });\n\nconst LINE_NUMBER_ATTRIBUTE = 'data-line-number';\n\nexport class RichScreenReaderContent extends Disposable implements IScreenReaderContent {\n\n\tprivate readonly _selectionChangeListener = this._register(new MutableDisposable());\n\n\tprivate _accessibilityPageSize: number = 1;\n\tprivate _ignoreSelectionChangeTime: number = 0;\n\n\tprivate _state: RichScreenReaderState = RichScreenReaderState.NULL;\n\tprivate _strategy: RichPagedScreenReaderStrategy = new RichPagedScreenReaderStrategy();\n\n\tprivate _renderedLines: Map<number, RichRenderedScreenReaderLine> = new Map();\n\tprivate _renderedSelection: Selection = new Selection(1, 1, 1, 1);\n\n\tconstructor(\n\t\tprivate readonly _domNode: FastDomNode<HTMLElement>,\n\t\tprivate readonly _context: ViewContext,\n\t\tprivate readonly _viewController: ViewController,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService\n\t) {\n\t\tsuper();\n\t\tthis.onConfigurationChanged(this._context.configuration.options);\n\t}\n\n\tpublic updateScreenReaderContent(primarySelection: Selection): void {\n\t\tconst focusedElement = getActiveWindow().document.activeElement;\n\t\tif (!focusedElement || focusedElement !== this._domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\tif (isScreenReaderOptimized) {\n\t\t\tconst state = this._getScreenReaderContentLineIntervals(primarySelection);\n\t\t\tif (!this._state.equals(state)) {\n\t\t\t\tthis._state = state;\n\t\t\t\tthis._renderedLines = this._renderScreenReaderContent(state);\n\t\t\t}\n\t\t\tif (!this._renderedSelection.equalsSelection(primarySelection)) {\n\t\t\t\tthis._renderedSelection = primarySelection;\n\t\t\t\tthis._setSelectionOnScreenReaderContent(this._context, this._renderedLines, primarySelection);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._state = RichScreenReaderState.NULL;\n\t\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\t\tthis._domNode.domNode.textContent = '';\n\t\t}\n\t}\n\n\tpublic updateScrollTop(primarySelection: Selection): void {\n\t\tconst intervals = this._state.intervals;\n\t\tif (!intervals.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewLayout = this._context.viewModel.viewLayout;\n\t\tconst stateStartLineNumber = intervals[0].startLine;\n\t\tconst verticalOffsetOfStateStartLineNumber = viewLayout.getVerticalOffsetForLineNumber(stateStartLineNumber);\n\t\tconst verticalOffsetOfPositionLineNumber = viewLayout.getVerticalOffsetForLineNumber(primarySelection.positionLineNumber);\n\t\tthis._domNode.domNode.scrollTop = verticalOffsetOfPositionLineNumber - verticalOffsetOfStateStartLineNumber;\n\t}\n\n\tpublic onFocusChange(newFocusValue: boolean): void {\n\t\tif (newFocusValue) {\n\t\t\tthis._selectionChangeListener.value = this._setSelectionChangeListener();\n\t\t} else {\n\t\t\tthis._selectionChangeListener.value = undefined;\n\t\t}\n\t}\n\n\tpublic onConfigurationChanged(options: IComputedEditorOptions): void {\n\t\tthis._accessibilityPageSize = options.get(EditorOption.accessibilityPageSize);\n\t}\n\n\tpublic onWillCut(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onCut');\n\t}\n\n\tpublic onWillPaste(): void {\n\t\tthis._setIgnoreSelectionChangeTime('onWillPaste');\n\t}\n\n\t// --- private methods\n\n\tprivate _setIgnoreSelectionChangeTime(reason: string): void {\n\t\tthis._ignoreSelectionChangeTime = Date.now();\n\t}\n\n\tprivate _setSelectionChangeListener(): 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 or NVDA for example, it is possible for users to reposition the\n\t\t// system caret. This is reflected in Chrome as a `selectionchange` event and needs to be reflected within the editor.\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 addDisposableListener(this._domNode.domNode.ownerDocument, 'selectionchange', () => {\n\t\t\tconst activeElement = getActiveWindow().document.activeElement;\n\t\t\tconst isFocused = activeElement === this._domNode.domNode;\n\t\t\tif (!isFocused) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();\n\t\t\tif (!isScreenReaderOptimized || !IME.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst now = Date.now();\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\t\t\tconst delta2 = now - this._ignoreSelectionChangeTime;\n\t\t\tthis._ignoreSelectionChangeTime = 0;\n\t\t\tif (delta2 < 100) {\n\t\t\t\t// received a `selectionchange` event within 100ms since we touched the hidden div\n\t\t\t\t// => ignore it, since we caused it\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst selection = this._getEditorSelectionFromDomRange();\n\t\t\tif (!selection) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._viewController.setSelection(selection);\n\t\t});\n\t}\n\n\tprivate _renderScreenReaderContent(state: RichScreenReaderState): Map<number, RichRenderedScreenReaderLine> {\n\t\tconst nodes: HTMLDivElement[] = [];\n\t\tconst renderedLines = new Map<number, RichRenderedScreenReaderLine>();\n\t\tfor (const interval of state.intervals) {\n\t\t\tfor (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {\n\t\t\t\tconst renderedLine = this._renderLine(lineNumber);\n\t\t\t\trenderedLines.set(lineNumber, renderedLine);\n\t\t\t\tnodes.push(renderedLine.domNode);\n\t\t\t}\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setValue');\n\t\tthis._domNode.domNode.replaceChildren(...nodes);\n\t\treturn renderedLines;\n\t}\n\n\tprivate _renderLine(viewLineNumber: number): RichRenderedScreenReaderLine {\n\t\tconst viewModel = this._context.viewModel;\n\t\tconst positionLineData = viewModel.getViewLineRenderingData(viewLineNumber);\n\t\tconst options = this._context.configuration.options;\n\t\tconst fontInfo = options.get(EditorOption.fontInfo);\n\t\tconst stopRenderingLineAfter = options.get(EditorOption.stopRenderingLineAfter);\n\t\tconst renderControlCharacters = options.get(EditorOption.renderControlCharacters);\n\t\tconst fontLigatures = options.get(EditorOption.fontLigatures);\n\t\tconst disableMonospaceOptimizations = options.get(EditorOption.disableMonospaceOptimizations);\n\t\tconst lineDecorations = LineDecoration.filter(positionLineData.inlineDecorations, viewLineNumber, positionLineData.minColumn, positionLineData.maxColumn);\n\t\tconst useMonospaceOptimizations = fontInfo.isMonospace && !disableMonospaceOptimizations;\n\t\tconst useFontLigatures = fontLigatures !== EditorFontLigatures.OFF;\n\t\tlet renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>;\n\t\tconst experimentalWhitespaceRendering = options.get(EditorOption.experimentalWhitespaceRendering);\n\t\tif (experimentalWhitespaceRendering === 'off') {\n\t\t\trenderWhitespace = options.get(EditorOption.renderWhitespace);\n\t\t} else {\n\t\t\trenderWhitespace = 'none';\n\t\t}\n\t\tconst renderLineInput = new RenderLineInput(\n\t\t\tuseMonospaceOptimizations,\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tpositionLineData.content,\n\t\t\tpositionLineData.continuesWithWrappedLine,\n\t\t\tpositionLineData.isBasicASCII,\n\t\t\tpositionLineData.containsRTL,\n\t\t\tpositionLineData.minColumn - 1,\n\t\t\tpositionLineData.tokens,\n\t\t\tlineDecorations,\n\t\t\tpositionLineData.tabSize,\n\t\t\tpositionLineData.startVisibleColumn,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tuseFontLigatures,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0,\n\t\t\ttrue\n\t\t);\n\t\tconst htmlBuilder = new StringBuilder(10000);\n\t\tconst renderOutput = renderViewLine(renderLineInput, htmlBuilder);\n\t\tconst html = htmlBuilder.build();\n\t\tconst trustedhtml = ttPolicy?.createHTML(html) ?? html;\n\t\tconst lineHeight = viewModel.viewLayout.getLineHeightForLineNumber(viewLineNumber) + 'px';\n\t\tconst domNode = document.createElement('div');\n\t\tdomNode.innerHTML = trustedhtml as string;\n\t\tdomNode.style.lineHeight = lineHeight;\n\t\tdomNode.style.height = lineHeight;\n\t\tdomNode.setAttribute(LINE_NUMBER_ATTRIBUTE, viewLineNumber.toString());\n\t\treturn new RichRenderedScreenReaderLine(domNode, renderOutput.characterMapping);\n\t}\n\n\tprivate _setSelectionOnScreenReaderContent(context: ViewContext, renderedLines: Map<number, RichRenderedScreenReaderLine>, viewSelection: Selection): void {\n\t\tconst activeDocument = getActiveWindow().document;\n\t\tconst activeDocumentSelection = activeDocument.getSelection();\n\t\tif (!activeDocumentSelection) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = viewSelection.startLineNumber;\n\t\tconst endLineNumber = viewSelection.endLineNumber;\n\t\tconst startRenderedLine = renderedLines.get(startLineNumber);\n\t\tconst endRenderedLine = renderedLines.get(endLineNumber);\n\t\tif (!startRenderedLine || !endRenderedLine) {\n\t\t\treturn;\n\t\t}\n\t\tconst viewModel = context.viewModel;\n\t\tconst model = viewModel.model;\n\t\tconst coordinatesConverter = viewModel.coordinatesConverter;\n\t\tconst startRange = new Range(startLineNumber, 1, startLineNumber, viewSelection.selectionStartColumn);\n\t\tconst modelStartRange = coordinatesConverter.convertViewRangeToModelRange(startRange);\n\t\tconst characterCountForStart = model.getCharacterCountInRange(modelStartRange);\n\t\tconst endRange = new Range(endLineNumber, 1, endLineNumber, viewSelection.positionColumn);\n\t\tconst modelEndRange = coordinatesConverter.convertViewRangeToModelRange(endRange);\n\t\tconst characterCountForEnd = model.getCharacterCountInRange(modelEndRange);\n\t\tconst startDomPosition = startRenderedLine.characterMapping.getDomPosition(characterCountForStart);\n\t\tconst endDomPosition = endRenderedLine.characterMapping.getDomPosition(characterCountForEnd);\n\t\tconst startDomNode = startRenderedLine.domNode.firstChild!;\n\t\tconst endDomNode = endRenderedLine.domNode.firstChild!;\n\t\tconst startChildren = startDomNode.childNodes;\n\t\tconst endChildren = endDomNode.childNodes;\n\t\tconst startNode = startChildren.item(startDomPosition.partIndex);\n\t\tconst endNode = endChildren.item(endDomPosition.partIndex);\n\t\tif (!startNode.firstChild || !endNode.firstChild) {\n\t\t\treturn;\n\t\t}\n\t\tthis._setIgnoreSelectionChangeTime('setRange');\n\t\tactiveDocumentSelection.setBaseAndExtent(\n\t\t\tstartNode.firstChild,\n\t\t\tviewSelection.startColumn === 1 ? 0 : startDomPosition.charIndex + 1,\n\t\t\tendNode.firstChild,\n\t\t\tviewSelection.endColumn === 1 ? 0 : endDomPosition.charIndex + 1\n\t\t);\n\t}\n\n\tprivate _getScreenReaderContentLineIntervals(primarySelection: Selection): RichScreenReaderState {\n\t\treturn this._strategy.fromEditorSelection(this._context.viewModel, primarySelection, this._accessibilityPageSize);\n\t}\n\n\tprivate _getEditorSelectionFromDomRange(): Selection | undefined {\n\t\tif (!this._renderedLines) {\n\t\t\treturn;\n\t\t}\n\t\tconst selection = getActiveWindow().document.getSelection();\n\t\tif (!selection) {\n\t\t\treturn;\n\t\t}\n\t\tconst rangeCount = selection.rangeCount;\n\t\tif (rangeCount === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst range = selection.getRangeAt(0);\n\t\tconst startContainer = range.startContainer;\n\t\tconst endContainer = range.endContainer;\n\t\tconst startSpanElement = startContainer.parentElement;\n\t\tconst endSpanElement = endContainer.parentElement;\n\t\tif (!startSpanElement || !isHTMLElement(startSpanElement) || !endSpanElement || !isHTMLElement(endSpanElement)) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineDomNode = startSpanElement.parentElement?.parentElement;\n\t\tconst endLineDomNode = endSpanElement.parentElement?.parentElement;\n\t\tif (!startLineDomNode || !endLineDomNode) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumberAttribute = startLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tconst endLineNumberAttribute = endLineDomNode.getAttribute(LINE_NUMBER_ATTRIBUTE);\n\t\tif (!startLineNumberAttribute || !endLineNumberAttribute) {\n\t\t\treturn;\n\t\t}\n\t\tconst startLineNumber = parseInt(startLineNumberAttribute);\n\t\tconst endLineNumber = parseInt(endLineNumberAttribute);\n\t\tconst startMapping = this._renderedLines.get(startLineNumber)?.characterMapping;\n\t\tconst endMapping = this._renderedLines.get(endLineNumber)?.characterMapping;\n\t\tif (!startMapping || !endMapping) {\n\t\t\treturn;\n\t\t}\n\t\tconst startColumn = getColumnOfNodeOffset(startMapping, startSpanElement, range.startOffset);\n\t\tconst endColumn = getColumnOfNodeOffset(endMapping, endSpanElement, range.endOffset);\n\t\tif (selection.direction === 'forward') {\n\t\t\treturn new Selection(\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn,\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn\n\t\t\t);\n\t\t} else {\n\t\t\treturn new Selection(\n\t\t\t\tendLineNumber,\n\t\t\t\tendColumn,\n\t\t\t\tstartLineNumber,\n\t\t\t\tstartColumn\n\t\t\t);\n\t\t}\n\t}\n}\n\nclass RichRenderedScreenReaderLine {\n\tconstructor(\n\t\tpublic readonly domNode: HTMLDivElement,\n\t\tpublic readonly characterMapping: CharacterMapping\n\t) { }\n}\n\nclass LineInterval {\n\tconstructor(\n\t\tpublic readonly startLine: number,\n\t\tpublic readonly endLine: number\n\t) { }\n}\n\nclass RichScreenReaderState {\n\n\tpublic readonly value: string;\n\n\tconstructor(model: ISimpleModel, public readonly intervals: LineInterval[]) {\n\t\tlet value = '';\n\t\tfor (const interval of intervals) {\n\t\t\tfor (let lineNumber = interval.startLine; lineNumber <= interval.endLine; lineNumber++) {\n\t\t\t\tvalue += model.getLineContent(lineNumber) + '\\n';\n\t\t\t}\n\t\t}\n\t\tthis.value = value;\n\t}\n\n\tequals(other: RichScreenReaderState): boolean {\n\t\treturn this.value === other.value;\n\t}\n\n\tstatic get NULL(): RichScreenReaderState {\n\t\tconst nullModel: ISimpleModel = {\n\t\t\tgetLineContent: () => '',\n\t\t\tgetLineCount: () => 1,\n\t\t\tgetLineMaxColumn: () => 1,\n\t\t\tgetValueInRange: () => '',\n\t\t\tgetValueLengthInRange: () => 0,\n\t\t\tmodifyPosition: (position, offset) => position\n\t\t};\n\t\treturn new RichScreenReaderState(nullModel, []);\n\t}\n}\n\nclass RichPagedScreenReaderStrategy implements IPagedScreenReaderStrategy<RichScreenReaderState> {\n\n\tconstructor() { }\n\n\tprivate _getPageOfLine(lineNumber: number, linesPerPage: number): number {\n\t\treturn Math.floor((lineNumber - 1) / linesPerPage);\n\t}\n\n\tprivate _getRangeForPage(context: ISimpleModel, page: number, linesPerPage: number): LineInterval {\n\t\tconst offset = page * linesPerPage;\n\t\tconst startLineNumber = offset + 1;\n\t\tconst endLineNumber = Math.min(offset + linesPerPage, context.getLineCount());\n\t\treturn new LineInterval(startLineNumber, endLineNumber);\n\t}\n\n\tpublic fromEditorSelection(context: ISimpleModel, viewSelection: Selection, linesPerPage: number): RichScreenReaderState {\n\t\tconst selectionStartPage = this._getPageOfLine(viewSelection.startLineNumber, linesPerPage);\n\t\tconst selectionStartPageRange = this._getRangeForPage(context, selectionStartPage, linesPerPage);\n\t\tconst selectionEndPage = this._getPageOfLine(viewSelection.endLineNumber, linesPerPage);\n\t\tconst selectionEndPageRange = this._getRangeForPage(context, selectionEndPage, linesPerPage);\n\t\tconst lineIntervals: LineInterval[] = [{ startLine: selectionStartPageRange.startLine, endLine: selectionStartPageRange.endLine }];\n\t\tif (selectionStartPage + 1 < selectionEndPage) {\n\t\t\tlineIntervals.push({ startLine: selectionEndPageRange.startLine, endLine: selectionEndPageRange.endLine });\n\t\t}\n\t\treturn new RichScreenReaderState(context, lineIntervals);\n\t}\n}\n"]}
@@ -13,7 +13,7 @@
13
13
  max-width: 700px;
14
14
  background: var(--vscode-editorHoverWidget-background);
15
15
  border: 1px solid var(--vscode-editorHoverWidget-border);
16
- border-radius: 3px;
16
+ border-radius: 5px;
17
17
  color: var(--vscode-editorHoverWidget-foreground);
18
18
  box-shadow: 0 2px 8px var(--vscode-widget-shadow);
19
19
  }
@@ -2130,7 +2130,7 @@ class InlineEditorSuggest extends BaseEditorOption {
2130
2130
  renderSideBySide: 'auto',
2131
2131
  allowCodeShifting: 'always',
2132
2132
  },
2133
- triggerCommandOnProviderChange: false,
2133
+ triggerCommandOnProviderChange: true,
2134
2134
  experimental: {
2135
2135
  suppressInlineSuggestions: '',
2136
2136
  showOnSuggestConflict: 'never',