monaco-editor-core 0.56.0-dev-20251124 → 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.
Files changed (337) hide show
  1. package/esm/nls.keys.json +1 -1
  2. package/esm/nls.messages.cs.js +2 -2
  3. package/esm/nls.messages.de.js +2 -2
  4. package/esm/nls.messages.es.js +2 -2
  5. package/esm/nls.messages.fr.js +2 -2
  6. package/esm/nls.messages.it.js +2 -2
  7. package/esm/nls.messages.ja.js +2 -2
  8. package/esm/nls.messages.js +1 -1
  9. package/esm/nls.messages.json +1 -1
  10. package/esm/nls.messages.ko.js +2 -2
  11. package/esm/nls.messages.pl.js +2 -2
  12. package/esm/nls.messages.pt-br.js +2 -2
  13. package/esm/nls.messages.ru.js +2 -2
  14. package/esm/nls.messages.tr.js +2 -2
  15. package/esm/nls.messages.zh-cn.js +2 -2
  16. package/esm/nls.messages.zh-tw.js +2 -2
  17. package/esm/nls.metadata.json +34 -2
  18. package/esm/vs/base/browser/dom.js +1 -4
  19. package/esm/vs/base/browser/dom.js.map +1 -1
  20. package/esm/vs/base/browser/markdownRenderer.js +25 -11
  21. package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
  22. package/esm/vs/base/browser/ui/button/button.js +15 -8
  23. package/esm/vs/base/browser/ui/button/button.js.map +1 -1
  24. package/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +3 -8
  25. package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  26. package/esm/vs/base/browser/ui/list/list.css +1 -0
  27. package/esm/vs/base/browser/ui/toolbar/toolbar.js +3 -0
  28. package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
  29. package/esm/vs/base/common/async.js +11 -0
  30. package/esm/vs/base/common/async.js.map +1 -1
  31. package/esm/vs/base/common/codiconsLibrary.js +11 -2
  32. package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
  33. package/esm/vs/base/common/defaultAccount.js +6 -0
  34. package/esm/vs/base/common/defaultAccount.js.map +1 -0
  35. package/esm/vs/base/common/equals.js +73 -24
  36. package/esm/vs/base/common/equals.js.map +1 -1
  37. package/esm/vs/base/common/event.js +14 -4
  38. package/esm/vs/base/common/event.js.map +1 -1
  39. package/esm/vs/base/common/iterator.js.map +1 -1
  40. package/esm/vs/base/common/keybindings.js +0 -8
  41. package/esm/vs/base/common/keybindings.js.map +1 -1
  42. package/esm/vs/base/common/lifecycle.js +2 -2
  43. package/esm/vs/base/common/lifecycle.js.map +1 -1
  44. package/esm/vs/base/common/marshallingIds.js.map +1 -1
  45. package/esm/vs/base/common/observableInternal/index.js +1 -1
  46. package/esm/vs/base/common/observableInternal/index.js.map +1 -1
  47. package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -1
  48. package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
  49. package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +16 -0
  50. package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
  51. package/esm/vs/base/common/observableInternal/utils/utils.js +11 -0
  52. package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
  53. package/esm/vs/base/common/product.js.map +1 -1
  54. package/esm/vs/base/common/strings.js +3 -1
  55. package/esm/vs/base/common/strings.js.map +1 -1
  56. package/esm/vs/editor/browser/controller/dragScrolling.js +2 -1
  57. package/esm/vs/editor/browser/controller/dragScrolling.js.map +1 -1
  58. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +73 -2
  59. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
  60. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +7 -51
  61. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
  62. package/esm/vs/editor/browser/controller/editContext/screenReaderUtils.js.map +1 -1
  63. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +7 -20
  64. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
  65. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +14 -44
  66. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
  67. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js +19 -0
  68. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map +1 -0
  69. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js +14 -1
  70. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js.map +1 -1
  71. package/esm/vs/editor/browser/controller/mouseHandler.js +5 -2
  72. package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
  73. package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
  74. package/esm/vs/editor/browser/observableCodeEditor.js +32 -15
  75. package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
  76. package/esm/vs/editor/browser/view.js +11 -2
  77. package/esm/vs/editor/browser/view.js.map +1 -1
  78. package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +5 -2
  79. package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
  80. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +10 -0
  81. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
  82. package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
  83. package/esm/vs/editor/browser/widget/multiDiffEditor/style.css +48 -0
  84. package/esm/vs/editor/common/config/fontInfo.js +1 -1
  85. package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
  86. package/esm/vs/editor/common/core/edits/edit.js +19 -0
  87. package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
  88. package/esm/vs/editor/common/core/edits/stringEdit.js +13 -0
  89. package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
  90. package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
  91. package/esm/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
  92. package/esm/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
  93. package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
  94. package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
  95. package/esm/vs/editor/common/cursor/cursorWordOperations.js +6 -3
  96. package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
  97. package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js +2 -2
  98. package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
  99. package/esm/vs/editor/common/languages/nullTokenize.js +1 -1
  100. package/esm/vs/editor/common/languages/nullTokenize.js.map +1 -1
  101. package/esm/vs/editor/common/languages/supports/tokenization.js +3 -0
  102. package/esm/vs/editor/common/languages/supports/tokenization.js.map +1 -1
  103. package/esm/vs/editor/common/languages.js +2 -1
  104. package/esm/vs/editor/common/languages.js.map +1 -1
  105. package/esm/vs/editor/common/model/decorationProvider.js +21 -1
  106. package/esm/vs/editor/common/model/decorationProvider.js.map +1 -1
  107. package/esm/vs/editor/common/model/textModel.js +49 -30
  108. package/esm/vs/editor/common/model/textModel.js.map +1 -1
  109. package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js +6 -3
  110. package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js.map +1 -1
  111. package/esm/vs/editor/common/model/tokens/annotations.js +177 -0
  112. package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -0
  113. package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +131 -0
  114. package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -0
  115. package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js +9 -0
  116. package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js.map +1 -1
  117. package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js +9 -0
  118. package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js.map +1 -1
  119. package/esm/vs/editor/common/textModelEditSource.js +2 -0
  120. package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
  121. package/esm/vs/editor/common/textModelEvents.js.map +1 -1
  122. package/esm/vs/editor/common/viewLayout/lineDecorations.js.map +1 -1
  123. package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +1 -1
  124. package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
  125. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +54 -36
  126. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
  127. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +14 -1
  128. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
  129. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
  130. package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
  131. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +1 -1
  132. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
  133. package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
  134. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -0
  135. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
  136. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +2 -0
  137. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
  138. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +33 -4
  139. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
  140. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -12
  141. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js.map +1 -1
  142. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -1
  143. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
  144. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
  145. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
  146. package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js +2 -1
  147. package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js.map +1 -1
  148. package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js +8 -0
  149. package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js.map +1 -0
  150. package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js +198 -0
  151. package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js.map +1 -0
  152. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js +40 -0
  153. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js.map +1 -0
  154. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +128 -65
  155. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
  156. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +69 -13
  157. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
  158. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +159 -94
  159. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
  160. package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +124 -50
  161. package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
  162. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +393 -0
  163. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -0
  164. package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
  165. package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js +20 -0
  166. package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js.map +1 -1
  167. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +59 -42
  168. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
  169. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +29 -8
  170. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
  171. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +78 -46
  172. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
  173. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +9 -4
  174. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
  175. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +11 -4
  176. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
  177. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +81 -41
  178. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
  179. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js +48 -0
  180. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
  181. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +18 -15
  182. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
  183. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js +3 -4
  184. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js.map +1 -1
  185. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -7
  186. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
  187. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +4 -5
  188. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
  189. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +4 -3
  190. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
  191. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +8 -8
  192. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
  193. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +9 -7
  194. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
  195. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +203 -41
  196. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
  197. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js +189 -0
  198. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js.map +1 -0
  199. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +85 -102
  200. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
  201. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +75 -32
  202. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
  203. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js +121 -0
  204. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js.map +1 -0
  205. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
  206. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
  207. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -20
  208. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
  209. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +15 -5
  210. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
  211. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +39 -6
  212. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +10 -5
  213. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
  214. package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
  215. package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
  216. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
  217. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
  218. package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
  219. package/esm/vs/editor/contrib/links/browser/links.js +10 -10
  220. package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
  221. package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
  222. package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
  223. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
  224. package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
  225. package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
  226. package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +11 -11
  227. package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
  228. package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
  229. package/esm/vs/editor/contrib/rename/browser/rename.js +19 -11
  230. package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
  231. package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
  232. package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +3 -2
  233. package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js.map +1 -1
  234. package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
  235. package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
  236. package/esm/vs/editor/contrib/snippet/browser/snippetParser.js +33 -0
  237. package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
  238. package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
  239. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
  240. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -4
  241. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
  242. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -0
  243. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
  244. package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -8
  245. package/esm/vs/editor/contrib/suggest/browser/suggest.js.map +1 -1
  246. package/esm/vs/editor/contrib/suggest/browser/suggestController.js +39 -28
  247. package/esm/vs/editor/contrib/suggest/browser/suggestController.js.map +1 -1
  248. package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +1 -0
  249. package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
  250. package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +22 -18
  251. package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js.map +1 -1
  252. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +28 -6
  253. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
  254. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
  255. package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
  256. package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
  257. package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
  258. package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
  259. package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
  260. package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
  261. package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
  262. package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
  263. package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
  264. package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +19 -2
  265. package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js.map +1 -1
  266. package/esm/vs/editor/editor.api.d.ts +37 -2
  267. package/esm/vs/editor/standalone/browser/standaloneLanguages.js +2 -2
  268. package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
  269. package/esm/vs/editor/standalone/browser/standaloneServices.js +11 -1
  270. package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
  271. package/esm/vs/editor/standalone/common/monarch/monarchLexer.js +1 -1
  272. package/esm/vs/editor/standalone/common/monarch/monarchLexer.js.map +1 -1
  273. package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
  274. package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
  275. package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
  276. package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -8
  277. package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
  278. package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
  279. package/esm/vs/platform/actions/browser/toolbar.js +2 -2
  280. package/esm/vs/platform/actions/common/actions.js +11 -4
  281. package/esm/vs/platform/actions/common/actions.js.map +1 -1
  282. package/esm/vs/platform/actions/common/menuService.js +2 -2
  283. package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
  284. package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
  285. package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
  286. package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
  287. package/esm/vs/platform/contextkey/common/scanner.js +5 -5
  288. package/esm/vs/platform/{product/common/productService.js → defaultAccount/common/defaultAccount.js} +2 -2
  289. package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -0
  290. package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
  291. package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
  292. package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
  293. package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
  294. package/esm/vs/platform/instantiation/common/instantiationService.js +1 -8
  295. package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
  296. package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
  297. package/esm/vs/platform/list/browser/listService.js +27 -27
  298. package/esm/vs/platform/log/common/log.js +1 -1
  299. package/esm/vs/platform/log/common/log.js.map +1 -1
  300. package/esm/vs/platform/markers/common/markerService.js +6 -6
  301. package/esm/vs/platform/markers/common/markerService.js.map +1 -1
  302. package/esm/vs/platform/markers/common/markers.js +6 -6
  303. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
  304. package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
  305. package/esm/vs/platform/quickinput/browser/media/quickInput.css +7 -3
  306. package/esm/vs/platform/quickinput/browser/quickInput.js +19 -11
  307. package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
  308. package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
  309. package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
  310. package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
  311. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  312. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
  313. package/esm/vs/platform/theme/common/colorUtils.js +2 -2
  314. package/esm/vs/platform/theme/common/colors/baseColors.js +18 -17
  315. package/esm/vs/platform/theme/common/colors/baseColors.js.map +1 -1
  316. package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
  317. package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
  318. package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
  319. package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
  320. package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
  321. package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
  322. package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
  323. package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
  324. package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
  325. package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
  326. package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
  327. package/esm/vs/platform/undoRedo/common/undoRedoService.js +21 -21
  328. package/esm/vs/platform/undoRedo/common/undoRedoService.js.map +1 -1
  329. package/esm/vs/platform/window/common/window.js +1 -1
  330. package/esm/vs/platform/window/common/window.js.map +1 -1
  331. package/esm/vs/platform/workspace/common/workspace.js +1 -1
  332. package/monaco.d.ts +37 -2
  333. package/package.json +2 -2
  334. package/version.txt +1 -1
  335. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +0 -16
  336. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +0 -1
  337. package/esm/vs/platform/product/common/productService.js.map +0 -1
@@ -96,6 +96,7 @@ export class TopBottomDragScrollingOperation extends DragScrollingOperation {
96
96
  this._viewHelper.renderNow();
97
97
  const viewportData = this._context.viewLayout.getLinesViewportData();
98
98
  const edgeLineNumber = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber : viewportData.endLineNumber);
99
+ const cannotScrollAnymore = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber === 1 : viewportData.endLineNumber === this._context.viewModel.getLineCount());
99
100
  // First, try to find a position that matches the horizontal position of the mouse
100
101
  let mouseTarget;
101
102
  {
@@ -105,7 +106,7 @@ export class TopBottomDragScrollingOperation extends DragScrollingOperation {
105
106
  const relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);
106
107
  mouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);
107
108
  }
108
- if (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber) {
109
+ if (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber || cannotScrollAnymore) {
109
110
  if (this._position.outsidePosition === 'above') {
110
111
  mouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), 'above', this._position.outsideDistance);
111
112
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/dragScrolling.ts","vs/editor/browser/controller/dragScrolling.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAe,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAIzD,OAAO,EAAE,iCAAiC,EAAE,wBAAwB,EAAoB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjI,OAAO,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AAEnE,MAAM,OAAgB,aAAc,SAAQ,UAAU;IAIrD,YACoB,QAAqB,EACrB,WAAkC,EAClC,mBAAuC,EACvC,cAAmH;QAEtI,KAAK,EAAE,CAAC;QALW,aAAQ,GAAR,QAAQ,CAAa;QACrB,gBAAW,GAAX,WAAW,CAAuB;QAClC,wBAAmB,GAAnB,mBAAmB,CAAoB;QACvC,mBAAc,GAAd,cAAc,CAAqG;QAGtI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACxB,CAAC;IAEe,OAAO;QACtB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,QAAmC,EAAE,UAA4B;QAC7E,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACnD,CAAC;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,IAAI,CAAC,SAAS,CAAC,eAAe,KAAK,MAAM,EAAE,CAAC;YAC/C,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACvK,CAAC;aAAM,CAAC;YACP,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACxK,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,2CAAmC,CAAC;QACzE,IAAI,CAAC,yBAAyB,GAAG,GAAG,CAAC,4BAA4B,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9H,CAAC;CACD","file":"dragScrolling.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../base/browser/dom.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { Position } from '../../common/core/position.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { IMouseTarget, IMouseTargetOutsideEditor } from '../editorBrowser.js';\nimport { createCoordinatesRelativeToEditor, createEditorPagePosition, EditorMouseEvent, PageCoordinates } from '../editorDom.js';\nimport { IPointerHandlerHelper } from './mouseHandler.js';\nimport { MouseTarget, MouseTargetFactory } from './mouseTarget.js';\n\nexport abstract class DragScrolling extends Disposable {\n\n\tprivate _operation: DragScrollingOperation | null;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void\n\t) {\n\t\tsuper();\n\t\tthis._operation = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.stop();\n\t}\n\n\tpublic start(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.setPosition(position, mouseEvent);\n\t\t} else {\n\t\t\tthis._operation = this._createDragScrollingOperation(position, mouseEvent);\n\t\t}\n\t}\n\n\tpublic stop(): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.dispose();\n\t\t\tthis._operation = null;\n\t\t}\n\t}\n\n\tprotected abstract _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation;\n}\n\nexport abstract class DragScrollingOperation extends Disposable {\n\n\tprotected _position: IMouseTargetOutsideEditor;\n\tprotected _mouseEvent: EditorMouseEvent;\n\tprivate _lastTime: number;\n\tprotected _animationFrameDisposable: IDisposable;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void,\n\t\tposition: IMouseTargetOutsideEditor,\n\t\tmouseEvent: EditorMouseEvent\n\t) {\n\t\tsuper();\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t\tthis._lastTime = Date.now();\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseEvent.browserEvent), () => this._execute());\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._animationFrameDisposable.dispose();\n\t\tsuper.dispose();\n\t}\n\n\tpublic setPosition(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t}\n\n\t/**\n\t * update internal state and return elapsed ms since last time\n\t */\n\tprotected _tick(): number {\n\t\tconst now = Date.now();\n\t\tconst elapsed = now - this._lastTime;\n\t\tthis._lastTime = now;\n\t\treturn elapsed;\n\t}\n\n\tprotected abstract _execute(): void;\n\n}\n\nexport class TopBottomDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new TopBottomDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class TopBottomDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of lines per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst viewportInLines = this._context.configuration.options.get(EditorOption.layoutInfo).height / lineHeight;\n\t\tconst outsideDistanceInLines = this._position.outsideDistance / lineHeight;\n\n\t\tif (outsideDistanceInLines <= 1.5) {\n\t\t\treturn Math.max(30, viewportInLines * (1 + outsideDistanceInLines));\n\t\t}\n\t\tif (outsideDistanceInLines <= 3) {\n\t\t\treturn Math.max(60, viewportInLines * (2 + outsideDistanceInLines));\n\t\t}\n\t\treturn Math.max(200, viewportInLines * (7 + outsideDistanceInLines));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst scrollSpeedInLines = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInLines * (elapsed / 1000) * lineHeight;\n\t\tconst scrollValue = (this._position.outsidePosition === 'above' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(0, scrollValue);\n\t\tthis._viewHelper.renderNow();\n\n\t\tconst viewportData = this._context.viewLayout.getLinesViewportData();\n\t\tconst edgeLineNumber = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber : viewportData.endLineNumber);\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\t\tif (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber) {\n\t\t\tif (this._position.outsidePosition === 'above') {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), 'above', this._position.outsideDistance);\n\t\t\t} else {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, this._context.viewModel.getLineMaxColumn(edgeLineNumber)), 'below', this._position.outsideDistance);\n\t\t\t}\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n\t}\n}\n\nexport class LeftRightDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new LeftRightDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class LeftRightDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of cols per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst viewportInChars = this._context.configuration.options.get(EditorOption.layoutInfo).contentWidth / charWidth;\n\t\tconst outsideDistanceInChars = this._position.outsideDistance / charWidth;\n\t\tif (outsideDistanceInChars <= 1.5) {\n\t\t\treturn Math.max(30, viewportInChars * (1 + outsideDistanceInChars));\n\t\t}\n\t\tif (outsideDistanceInChars <= 3) {\n\t\t\treturn Math.max(60, viewportInChars * (2 + outsideDistanceInChars));\n\t\t}\n\t\treturn Math.max(200, viewportInChars * (7 + outsideDistanceInChars));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst scrollSpeedInChars = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInChars * (elapsed / 1000) * charWidth * 0.5;\n\t\tconst scrollValue = (this._position.outsidePosition === 'left' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(scrollValue, 0);\n\t\tthis._viewHelper.renderNow();\n\n\t\tif (!this._position.position) {\n\t\t\treturn;\n\t\t}\n\t\tconst edgeLineNumber = this._position.position.lineNumber;\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\n\t\tif (this._position.outsidePosition === 'left') {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'left', this._position.outsideDistance);\n\t\t} else {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'right', this._position.outsideDistance);\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\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 dom from '../../../base/browser/dom.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { Position } from '../../common/core/position.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { IMouseTarget, IMouseTargetOutsideEditor } from '../editorBrowser.js';\nimport { createCoordinatesRelativeToEditor, createEditorPagePosition, EditorMouseEvent, PageCoordinates } from '../editorDom.js';\nimport { IPointerHandlerHelper } from './mouseHandler.js';\nimport { MouseTarget, MouseTargetFactory } from './mouseTarget.js';\n\nexport abstract class DragScrolling extends Disposable {\n\n\tprivate _operation: DragScrollingOperation | null;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void\n\t) {\n\t\tsuper();\n\t\tthis._operation = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.stop();\n\t}\n\n\tpublic start(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.setPosition(position, mouseEvent);\n\t\t} else {\n\t\t\tthis._operation = this._createDragScrollingOperation(position, mouseEvent);\n\t\t}\n\t}\n\n\tpublic stop(): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.dispose();\n\t\t\tthis._operation = null;\n\t\t}\n\t}\n\n\tprotected abstract _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation;\n}\n\nexport abstract class DragScrollingOperation extends Disposable {\n\n\tprotected _position: IMouseTargetOutsideEditor;\n\tprotected _mouseEvent: EditorMouseEvent;\n\tprivate _lastTime: number;\n\tprotected _animationFrameDisposable: IDisposable;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void,\n\t\tposition: IMouseTargetOutsideEditor,\n\t\tmouseEvent: EditorMouseEvent\n\t) {\n\t\tsuper();\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t\tthis._lastTime = Date.now();\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseEvent.browserEvent), () => this._execute());\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._animationFrameDisposable.dispose();\n\t\tsuper.dispose();\n\t}\n\n\tpublic setPosition(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t}\n\n\t/**\n\t * update internal state and return elapsed ms since last time\n\t */\n\tprotected _tick(): number {\n\t\tconst now = Date.now();\n\t\tconst elapsed = now - this._lastTime;\n\t\tthis._lastTime = now;\n\t\treturn elapsed;\n\t}\n\n\tprotected abstract _execute(): void;\n\n}\n\nexport class TopBottomDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new TopBottomDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class TopBottomDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of lines per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst viewportInLines = this._context.configuration.options.get(EditorOption.layoutInfo).height / lineHeight;\n\t\tconst outsideDistanceInLines = this._position.outsideDistance / lineHeight;\n\n\t\tif (outsideDistanceInLines <= 1.5) {\n\t\t\treturn Math.max(30, viewportInLines * (1 + outsideDistanceInLines));\n\t\t}\n\t\tif (outsideDistanceInLines <= 3) {\n\t\t\treturn Math.max(60, viewportInLines * (2 + outsideDistanceInLines));\n\t\t}\n\t\treturn Math.max(200, viewportInLines * (7 + outsideDistanceInLines));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst scrollSpeedInLines = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInLines * (elapsed / 1000) * lineHeight;\n\t\tconst scrollValue = (this._position.outsidePosition === 'above' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(0, scrollValue);\n\t\tthis._viewHelper.renderNow();\n\n\t\tconst viewportData = this._context.viewLayout.getLinesViewportData();\n\t\tconst edgeLineNumber = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber : viewportData.endLineNumber);\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\t\tif (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber) {\n\t\t\tif (this._position.outsidePosition === 'above') {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), 'above', this._position.outsideDistance);\n\t\t\t} else {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, this._context.viewModel.getLineMaxColumn(edgeLineNumber)), 'below', this._position.outsideDistance);\n\t\t\t}\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n\t}\n}\n\nexport class LeftRightDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new LeftRightDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class LeftRightDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of cols per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst viewportInChars = this._context.configuration.options.get(EditorOption.layoutInfo).contentWidth / charWidth;\n\t\tconst outsideDistanceInChars = this._position.outsideDistance / charWidth;\n\t\tif (outsideDistanceInChars <= 1.5) {\n\t\t\treturn Math.max(30, viewportInChars * (1 + outsideDistanceInChars));\n\t\t}\n\t\tif (outsideDistanceInChars <= 3) {\n\t\t\treturn Math.max(60, viewportInChars * (2 + outsideDistanceInChars));\n\t\t}\n\t\treturn Math.max(200, viewportInChars * (7 + outsideDistanceInChars));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst scrollSpeedInChars = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInChars * (elapsed / 1000) * charWidth * 0.5;\n\t\tconst scrollValue = (this._position.outsidePosition === 'left' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(scrollValue, 0);\n\t\tthis._viewHelper.renderNow();\n\n\t\tif (!this._position.position) {\n\t\t\treturn;\n\t\t}\n\t\tconst edgeLineNumber = this._position.position.lineNumber;\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\n\t\tif (this._position.outsidePosition === 'left') {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'left', this._position.outsideDistance);\n\t\t} else {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'right', this._position.outsideDistance);\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/dragScrolling.ts","vs/editor/browser/controller/dragScrolling.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAe,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAIzD,OAAO,EAAE,iCAAiC,EAAE,wBAAwB,EAAoB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjI,OAAO,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AAEnE,MAAM,OAAgB,aAAc,SAAQ,UAAU;IAIrD,YACoB,QAAqB,EACrB,WAAkC,EAClC,mBAAuC,EACvC,cAAmH;QAEtI,KAAK,EAAE,CAAC;QALW,aAAQ,GAAR,QAAQ,CAAa;QACrB,gBAAW,GAAX,WAAW,CAAuB;QAClC,wBAAmB,GAAnB,mBAAmB,CAAoB;QACvC,mBAAc,GAAd,cAAc,CAAqG;QAGtI,IAAI,CAAC,UAAU,GAAG,IAAI,C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ragScrolling.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../base/browser/dom.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { Position } from '../../common/core/position.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { IMouseTarget, IMouseTargetOutsideEditor } from '../editorBrowser.js';\nimport { createCoordinatesRelativeToEditor, createEditorPagePosition, EditorMouseEvent, PageCoordinates } from '../editorDom.js';\nimport { IPointerHandlerHelper } from './mouseHandler.js';\nimport { MouseTarget, MouseTargetFactory } from './mouseTarget.js';\n\nexport abstract class DragScrolling extends Disposable {\n\n\tprivate _operation: DragScrollingOperation | null;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void\n\t) {\n\t\tsuper();\n\t\tthis._operation = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.stop();\n\t}\n\n\tpublic start(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.setPosition(position, mouseEvent);\n\t\t} else {\n\t\t\tthis._operation = this._createDragScrollingOperation(position, mouseEvent);\n\t\t}\n\t}\n\n\tpublic stop(): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.dispose();\n\t\t\tthis._operation = null;\n\t\t}\n\t}\n\n\tprotected abstract _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation;\n}\n\nexport abstract class DragScrollingOperation extends Disposable {\n\n\tprotected _position: IMouseTargetOutsideEditor;\n\tprotected _mouseEvent: EditorMouseEvent;\n\tprivate _lastTime: number;\n\tprotected _animationFrameDisposable: IDisposable;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void,\n\t\tposition: IMouseTargetOutsideEditor,\n\t\tmouseEvent: EditorMouseEvent\n\t) {\n\t\tsuper();\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t\tthis._lastTime = Date.now();\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseEvent.browserEvent), () => this._execute());\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._animationFrameDisposable.dispose();\n\t\tsuper.dispose();\n\t}\n\n\tpublic setPosition(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t}\n\n\t/**\n\t * update internal state and return elapsed ms since last time\n\t */\n\tprotected _tick(): number {\n\t\tconst now = Date.now();\n\t\tconst elapsed = now - this._lastTime;\n\t\tthis._lastTime = now;\n\t\treturn elapsed;\n\t}\n\n\tprotected abstract _execute(): void;\n\n}\n\nexport class TopBottomDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new TopBottomDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class TopBottomDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of lines per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst viewportInLines = this._context.configuration.options.get(EditorOption.layoutInfo).height / lineHeight;\n\t\tconst outsideDistanceInLines = this._position.outsideDistance / lineHeight;\n\n\t\tif (outsideDistanceInLines <= 1.5) {\n\t\t\treturn Math.max(30, viewportInLines * (1 + outsideDistanceInLines));\n\t\t}\n\t\tif (outsideDistanceInLines <= 3) {\n\t\t\treturn Math.max(60, viewportInLines * (2 + outsideDistanceInLines));\n\t\t}\n\t\treturn Math.max(200, viewportInLines * (7 + outsideDistanceInLines));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst scrollSpeedInLines = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInLines * (elapsed / 1000) * lineHeight;\n\t\tconst scrollValue = (this._position.outsidePosition === 'above' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(0, scrollValue);\n\t\tthis._viewHelper.renderNow();\n\n\t\tconst viewportData = this._context.viewLayout.getLinesViewportData();\n\t\tconst edgeLineNumber = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber : viewportData.endLineNumber);\n\t\tconst cannotScrollAnymore = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber === 1 : viewportData.endLineNumber === this._context.viewModel.getLineCount());\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\t\tif (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber || cannotScrollAnymore) {\n\t\t\tif (this._position.outsidePosition === 'above') {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), 'above', this._position.outsideDistance);\n\t\t\t} else {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, this._context.viewModel.getLineMaxColumn(edgeLineNumber)), 'below', this._position.outsideDistance);\n\t\t\t}\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n\t}\n}\n\nexport class LeftRightDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new LeftRightDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class LeftRightDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of cols per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst viewportInChars = this._context.configuration.options.get(EditorOption.layoutInfo).contentWidth / charWidth;\n\t\tconst outsideDistanceInChars = this._position.outsideDistance / charWidth;\n\t\tif (outsideDistanceInChars <= 1.5) {\n\t\t\treturn Math.max(30, viewportInChars * (1 + outsideDistanceInChars));\n\t\t}\n\t\tif (outsideDistanceInChars <= 3) {\n\t\t\treturn Math.max(60, viewportInChars * (2 + outsideDistanceInChars));\n\t\t}\n\t\treturn Math.max(200, viewportInChars * (7 + outsideDistanceInChars));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst scrollSpeedInChars = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInChars * (elapsed / 1000) * charWidth * 0.5;\n\t\tconst scrollValue = (this._position.outsidePosition === 'left' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(scrollValue, 0);\n\t\tthis._viewHelper.renderNow();\n\n\t\tif (!this._position.position) {\n\t\t\treturn;\n\t\t}\n\t\tconst edgeLineNumber = this._position.position.lineNumber;\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\n\t\tif (this._position.outsidePosition === 'left') {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'left', this._position.outsideDistance);\n\t\t} else {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'right', this._position.outsideDistance);\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\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 dom from '../../../base/browser/dom.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { EditorOption } from '../../common/config/editorOptions.js';\nimport { Position } from '../../common/core/position.js';\nimport { ViewContext } from '../../common/viewModel/viewContext.js';\nimport { NavigationCommandRevealType } from '../coreCommands.js';\nimport { IMouseTarget, IMouseTargetOutsideEditor } from '../editorBrowser.js';\nimport { createCoordinatesRelativeToEditor, createEditorPagePosition, EditorMouseEvent, PageCoordinates } from '../editorDom.js';\nimport { IPointerHandlerHelper } from './mouseHandler.js';\nimport { MouseTarget, MouseTargetFactory } from './mouseTarget.js';\n\nexport abstract class DragScrolling extends Disposable {\n\n\tprivate _operation: DragScrollingOperation | null;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void\n\t) {\n\t\tsuper();\n\t\tthis._operation = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.stop();\n\t}\n\n\tpublic start(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.setPosition(position, mouseEvent);\n\t\t} else {\n\t\t\tthis._operation = this._createDragScrollingOperation(position, mouseEvent);\n\t\t}\n\t}\n\n\tpublic stop(): void {\n\t\tif (this._operation) {\n\t\t\tthis._operation.dispose();\n\t\t\tthis._operation = null;\n\t\t}\n\t}\n\n\tprotected abstract _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation;\n}\n\nexport abstract class DragScrollingOperation extends Disposable {\n\n\tprotected _position: IMouseTargetOutsideEditor;\n\tprotected _mouseEvent: EditorMouseEvent;\n\tprivate _lastTime: number;\n\tprotected _animationFrameDisposable: IDisposable;\n\n\tconstructor(\n\t\tprotected readonly _context: ViewContext,\n\t\tprotected readonly _viewHelper: IPointerHandlerHelper,\n\t\tprotected readonly _mouseTargetFactory: MouseTargetFactory,\n\t\tprotected readonly _dispatchMouse: (position: IMouseTarget, inSelectionMode: boolean, revealType: NavigationCommandRevealType) => void,\n\t\tposition: IMouseTargetOutsideEditor,\n\t\tmouseEvent: EditorMouseEvent\n\t) {\n\t\tsuper();\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t\tthis._lastTime = Date.now();\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseEvent.browserEvent), () => this._execute());\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._animationFrameDisposable.dispose();\n\t\tsuper.dispose();\n\t}\n\n\tpublic setPosition(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): void {\n\t\tthis._position = position;\n\t\tthis._mouseEvent = mouseEvent;\n\t}\n\n\t/**\n\t * update internal state and return elapsed ms since last time\n\t */\n\tprotected _tick(): number {\n\t\tconst now = Date.now();\n\t\tconst elapsed = now - this._lastTime;\n\t\tthis._lastTime = now;\n\t\treturn elapsed;\n\t}\n\n\tprotected abstract _execute(): void;\n\n}\n\nexport class TopBottomDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new TopBottomDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class TopBottomDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of lines per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst viewportInLines = this._context.configuration.options.get(EditorOption.layoutInfo).height / lineHeight;\n\t\tconst outsideDistanceInLines = this._position.outsideDistance / lineHeight;\n\n\t\tif (outsideDistanceInLines <= 1.5) {\n\t\t\treturn Math.max(30, viewportInLines * (1 + outsideDistanceInLines));\n\t\t}\n\t\tif (outsideDistanceInLines <= 3) {\n\t\t\treturn Math.max(60, viewportInLines * (2 + outsideDistanceInLines));\n\t\t}\n\t\treturn Math.max(200, viewportInLines * (7 + outsideDistanceInLines));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst lineHeight = this._context.configuration.options.get(EditorOption.lineHeight);\n\t\tconst scrollSpeedInLines = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInLines * (elapsed / 1000) * lineHeight;\n\t\tconst scrollValue = (this._position.outsidePosition === 'above' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(0, scrollValue);\n\t\tthis._viewHelper.renderNow();\n\n\t\tconst viewportData = this._context.viewLayout.getLinesViewportData();\n\t\tconst edgeLineNumber = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber : viewportData.endLineNumber);\n\t\tconst cannotScrollAnymore = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber === 1 : viewportData.endLineNumber === this._context.viewModel.getLineCount());\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\t\tif (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber || cannotScrollAnymore) {\n\t\t\tif (this._position.outsidePosition === 'above') {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), 'above', this._position.outsideDistance);\n\t\t\t} else {\n\t\t\t\tmouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, this._context.viewModel.getLineMaxColumn(edgeLineNumber)), 'below', this._position.outsideDistance);\n\t\t\t}\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n\t}\n}\n\nexport class LeftRightDragScrolling extends DragScrolling {\n\tprotected _createDragScrollingOperation(position: IMouseTargetOutsideEditor, mouseEvent: EditorMouseEvent): DragScrollingOperation {\n\t\treturn new LeftRightDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n\t}\n}\n\nexport class LeftRightDragScrollingOperation extends DragScrollingOperation {\n\n\t/**\n\t * get the number of cols per second to auto-scroll\n\t */\n\tprivate _getScrollSpeed(): number {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst viewportInChars = this._context.configuration.options.get(EditorOption.layoutInfo).contentWidth / charWidth;\n\t\tconst outsideDistanceInChars = this._position.outsideDistance / charWidth;\n\t\tif (outsideDistanceInChars <= 1.5) {\n\t\t\treturn Math.max(30, viewportInChars * (1 + outsideDistanceInChars));\n\t\t}\n\t\tif (outsideDistanceInChars <= 3) {\n\t\t\treturn Math.max(60, viewportInChars * (2 + outsideDistanceInChars));\n\t\t}\n\t\treturn Math.max(200, viewportInChars * (7 + outsideDistanceInChars));\n\t}\n\n\tprotected _execute(): void {\n\t\tconst charWidth = this._context.configuration.options.get(EditorOption.fontInfo).typicalFullwidthCharacterWidth;\n\t\tconst scrollSpeedInChars = this._getScrollSpeed();\n\t\tconst elapsed = this._tick();\n\t\tconst scrollInPixels = scrollSpeedInChars * (elapsed / 1000) * charWidth * 0.5;\n\t\tconst scrollValue = (this._position.outsidePosition === 'left' ? -scrollInPixels : scrollInPixels);\n\n\t\tthis._context.viewModel.viewLayout.deltaScrollNow(scrollValue, 0);\n\t\tthis._viewHelper.renderNow();\n\n\t\tif (!this._position.position) {\n\t\t\treturn;\n\t\t}\n\t\tconst edgeLineNumber = this._position.position.lineNumber;\n\n\t\t// First, try to find a position that matches the horizontal position of the mouse\n\t\tlet mouseTarget: IMouseTarget;\n\t\t{\n\t\t\tconst editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n\t\t\tconst horizontalScrollbarHeight = this._context.configuration.options.get(EditorOption.layoutInfo).horizontalScrollbarHeight;\n\t\t\tconst pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n\t\t\tconst relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n\t\t\tmouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n\t\t}\n\n\t\tif (this._position.outsidePosition === 'left') {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'left', this._position.outsideDistance);\n\t\t} else {\n\t\t\tmouseTarget = MouseTarget.createOutsideEditor(mouseTarget.mouseColumn, new Position(edgeLineNumber, mouseTarget.mouseColumn), 'right', this._position.outsideDistance);\n\t\t}\n\n\t\tthis._dispatchMouse(mouseTarget, true, NavigationCommandRevealType.None);\n\t\tthis._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n\t}\n}\n"]}
@@ -1,6 +1,46 @@
1
1
  import { isWindows } from '../../../../base/common/platform.js';
2
2
  import { Mimes } from '../../../../base/common/mime.js';
3
- export function getDataToCopy(viewModel, modelSelections, emptySelectionClipboard, copyWithSyntaxHighlighting) {
3
+ import { LogLevel } from '../../../../platform/log/common/log.js';
4
+ import { generateUuid } from '../../../../base/common/uuid.js';
5
+ export function ensureClipboardGetsEditorSelection(e, context, logService, isFirefox) {
6
+ const viewModel = context.viewModel;
7
+ const options = context.configuration.options;
8
+ let id = undefined;
9
+ if (logService.getLevel() === LogLevel.Trace) {
10
+ id = generateUuid();
11
+ }
12
+ const { dataToCopy, storedMetadata } = generateDataToCopyAndStoreInMemory(viewModel, options, id, isFirefox);
13
+ // !!!!!
14
+ // This is a workaround for what we think is an Electron bug where
15
+ // execCommand('copy') does not always work (it does not fire a clipboard event)
16
+ // !!!!!
17
+ // We signal that we have executed a copy command
18
+ CopyOptions.electronBugWorkaroundCopyEventHasFired = true;
19
+ e.preventDefault();
20
+ if (e.clipboardData) {
21
+ ClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);
22
+ }
23
+ logService.trace('ensureClipboardGetsEditorSelection with id : ', id, ' with text.length: ', dataToCopy.text.length);
24
+ }
25
+ export function generateDataToCopyAndStoreInMemory(viewModel, options, id, isFirefox) {
26
+ const emptySelectionClipboard = options.get(45 /* EditorOption.emptySelectionClipboard */);
27
+ const copyWithSyntaxHighlighting = options.get(31 /* EditorOption.copyWithSyntaxHighlighting */);
28
+ const selections = viewModel.getCursorStates().map(cursorState => cursorState.modelState.selection);
29
+ const dataToCopy = getDataToCopy(viewModel, selections, emptySelectionClipboard, copyWithSyntaxHighlighting);
30
+ const storedMetadata = {
31
+ version: 1,
32
+ id,
33
+ isFromEmptySelection: dataToCopy.isFromEmptySelection,
34
+ multicursorText: dataToCopy.multicursorText,
35
+ mode: dataToCopy.mode
36
+ };
37
+ InMemoryClipboardMetadataManager.INSTANCE.set(
38
+ // When writing "LINE\r\n" to the clipboard and then pasting,
39
+ // Firefox pastes "LINE\n", so let's work around this quirk
40
+ (isFirefox ? dataToCopy.text.replace(/\r\n/g, '\n') : dataToCopy.text), storedMetadata);
41
+ return { dataToCopy, storedMetadata };
42
+ }
43
+ function getDataToCopy(viewModel, modelSelections, emptySelectionClipboard, copyWithSyntaxHighlighting) {
4
44
  const rawTextToCopy = viewModel.getPlainTextToCopy(modelSelections, emptySelectionClipboard, isWindows);
5
45
  const newLineCharacter = viewModel.model.getEOL();
6
46
  const isFromEmptySelection = (emptySelectionClipboard && modelSelections.length === 1 && modelSelections[0].isEmpty());
@@ -24,6 +64,33 @@ export function getDataToCopy(viewModel, modelSelections, emptySelectionClipboar
24
64
  };
25
65
  return dataToCopy;
26
66
  }
67
+ export function computePasteData(e, context, logService) {
68
+ e.preventDefault();
69
+ if (!e.clipboardData) {
70
+ return;
71
+ }
72
+ let [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
73
+ logService.trace('computePasteData with id : ', metadata?.id, ' with text.length: ', text.length);
74
+ if (!text) {
75
+ return;
76
+ }
77
+ PasteOptions.electronBugWorkaroundPasteEventHasFired = true;
78
+ metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
79
+ return getPasteDataFromMetadata(text, metadata, context);
80
+ }
81
+ export function getPasteDataFromMetadata(text, metadata, context) {
82
+ let pasteOnNewLine = false;
83
+ let multicursorText = null;
84
+ let mode = null;
85
+ if (metadata) {
86
+ const options = context.configuration.options;
87
+ const emptySelectionClipboard = options.get(45 /* EditorOption.emptySelectionClipboard */);
88
+ pasteOnNewLine = emptySelectionClipboard && !!metadata.isFromEmptySelection;
89
+ multicursorText = typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null;
90
+ mode = metadata.mode;
91
+ }
92
+ return { text, pasteOnNewLine, multicursorText, mode };
93
+ }
27
94
  /**
28
95
  * Every time we write to the clipboard, we record a bit of extra metadata here.
29
96
  * Every time we read from the cipboard, if the text matches our last written text,
@@ -47,7 +114,11 @@ export class InMemoryClipboardMetadataManager {
47
114
  }
48
115
  }
49
116
  export const CopyOptions = {
50
- forceCopyWithSyntaxHighlighting: false
117
+ forceCopyWithSyntaxHighlighting: false,
118
+ electronBugWorkaroundCopyEventHasFired: false
119
+ };
120
+ export const PasteOptions = {
121
+ electronBugWorkaroundPasteEventHasFired: false
51
122
  };
52
123
  export const ClipboardEventUtils = {
53
124
  getTextData(clipboardData) {
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/clipboardUtils.ts","vs/editor/browser/controller/editContext/clipboardUtils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,MAAM,UAAU,aAAa,CAAC,SAAqB,EAAE,eAAwB,EAAE,uBAAgC,EAAE,0BAAmC;IACnJ,MAAM,aAAa,GAAG,SAAS,CAAC,kBAAkB,CAAC,eAAe,EAAE,uBAAuB,EAAE,SAAS,CAAC,CAAC;IACxG,MAAM,gBAAgB,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IAElD,MAAM,oBAAoB,GAAG,CAAC,uBAAuB,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACvH,MAAM,eAAe,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAEnG,IAAI,IAAI,G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AI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,CAAC;CACD,CAAC","file":"clipboardUtils.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 *--------------------------------------------------------------------------------------------*/\nimport { IViewModel } from '../../../common/viewModel.js';\nimport { Range } from '../../../common/core/range.js';\nimport { isWindows } from '../../../../base/common/platform.js';\nimport { Mimes } from '../../../../base/common/mime.js';\n\nexport function getDataToCopy(viewModel: IViewModel, modelSelections: Range[], emptySelectionClipboard: boolean, copyWithSyntaxHighlighting: boolean): ClipboardDataToCopy {\n\tconst rawTextToCopy = viewModel.getPlainTextToCopy(modelSelections, emptySelectionClipboard, isWindows);\n\tconst newLineCharacter = viewModel.model.getEOL();\n\n\tconst isFromEmptySelection = (emptySelectionClipboard && modelSelections.length === 1 && modelSelections[0].isEmpty());\n\tconst multicursorText = (Array.isArray(rawTextToCopy) ? rawTextToCopy : null);\n\tconst text = (Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy);\n\n\tlet html: string | null | undefined = undefined;\n\tlet mode: string | null = null;\n\tif (CopyOptions.forceCopyWithSyntaxHighlighting || (copyWithSyntaxHighlighting && text.length < 65536)) {\n\t\tconst richText = viewModel.getRichTextToCopy(modelSelections, emptySelectionClipboard);\n\t\tif (richText) {\n\t\t\thtml = richText.html;\n\t\t\tmode = richText.mode;\n\t\t}\n\t}\n\tconst dataToCopy: ClipboardDataToCopy = {\n\t\tisFromEmptySelection,\n\t\tmulticursorText,\n\t\ttext,\n\t\thtml,\n\t\tmode\n\t};\n\treturn dataToCopy;\n}\n\n/**\n * Every time we write to the clipboard, we record a bit of extra metadata here.\n * Every time we read from the cipboard, if the text matches our last written text,\n * we can fetch the previous metadata.\n */\nexport class InMemoryClipboardMetadataManager {\n\tpublic static readonly INSTANCE = new InMemoryClipboardMetadataManager();\n\n\tprivate _lastState: InMemoryClipboardMetadata | null;\n\n\tconstructor() {\n\t\tthis._lastState = null;\n\t}\n\n\tpublic set(lastCopiedValue: string, data: ClipboardStoredMetadata): void {\n\t\tthis._lastState = { lastCopiedValue, data };\n\t}\n\n\tpublic get(pastedText: string): ClipboardStoredMetadata | null {\n\t\tif (this._lastState && this._lastState.lastCopiedValue === pastedText) {\n\t\t\t// match!\n\t\t\treturn this._lastState.data;\n\t\t}\n\t\tthis._lastState = null;\n\t\treturn null;\n\t}\n}\n\nexport interface ClipboardDataToCopy {\n\tisFromEmptySelection: boolean;\n\tmulticursorText: string[] | null | undefined;\n\ttext: string;\n\thtml: string | null | undefined;\n\tmode: string | null;\n}\n\nexport interface ClipboardStoredMetadata {\n\tversion: 1;\n\tid: string | undefined;\n\tisFromEmptySelection: boolean | undefined;\n\tmulticursorText: string[] | null | undefined;\n\tmode: string | null;\n}\n\nexport const CopyOptions = {\n\tforceCopyWithSyntaxHighlighting: false\n};\n\ninterface InMemoryClipboardMetadata {\n\tlastCopiedValue: string;\n\tdata: ClipboardStoredMetadata;\n}\n\nexport const ClipboardEventUtils = {\n\n\tgetTextData(clipboardData: DataTransfer): [string, ClipboardStoredMetadata | null] {\n\t\tconst text = clipboardData.getData(Mimes.text);\n\t\tlet metadata: ClipboardStoredMetadata | null = null;\n\t\tconst rawmetadata = clipboardData.getData('vscode-editor-data');\n\t\tif (typeof rawmetadata === 'string') {\n\t\t\ttry {\n\t\t\t\tmetadata = <ClipboardStoredMetadata>JSON.parse(rawmetadata);\n\t\t\t\tif (metadata.version !== 1) {\n\t\t\t\t\tmetadata = null;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// no problem!\n\t\t\t}\n\t\t}\n\t\tif (text.length === 0 && metadata === null && clipboardData.files.length > 0) {\n\t\t\t// no textual data pasted, generate text from file names\n\t\t\tconst files: File[] = Array.prototype.slice.call(clipboardData.files, 0);\n\t\t\treturn [files.map(file => file.name).join('\\n'), null];\n\t\t}\n\t\treturn [text, metadata];\n\t},\n\n\tsetTextData(clipboardData: DataTransfer, text: string, html: string | null | undefined, metadata: ClipboardStoredMetadata): void {\n\t\tclipboardData.setData(Mimes.text, text);\n\t\tif (typeof html === 'string') {\n\t\t\tclipboardData.setData('text/html', html);\n\t\t}\n\t\tclipboardData.setData('vscode-editor-data', JSON.stringify(metadata));\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 *--------------------------------------------------------------------------------------------*/\nimport { IViewModel } from '../../../common/viewModel.js';\nimport { Range } from '../../../common/core/range.js';\nimport { isWindows } from '../../../../base/common/platform.js';\nimport { Mimes } from '../../../../base/common/mime.js';\n\nexport function getDataToCopy(viewModel: IViewModel, modelSelections: Range[], emptySelectionClipboard: boolean, copyWithSyntaxHighlighting: boolean): ClipboardDataToCopy {\n\tconst rawTextToCopy = viewModel.getPlainTextToCopy(modelSelections, emptySelectionClipboard, isWindows);\n\tconst newLineCharacter = viewModel.model.getEOL();\n\n\tconst isFromEmptySelection = (emptySelectionClipboard && modelSelections.length === 1 && modelSelections[0].isEmpty());\n\tconst multicursorText = (Array.isArray(rawTextToCopy) ? rawTextToCopy : null);\n\tconst text = (Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy);\n\n\tlet html: string | null | undefined = undefined;\n\tlet mode: string | null = null;\n\tif (CopyOptions.forceCopyWithSyntaxHighlighting || (copyWithSyntaxHighlighting && text.length < 65536)) {\n\t\tconst richText = viewModel.getRichTextToCopy(modelSelections, emptySelectionClipboard);\n\t\tif (richText) {\n\t\t\thtml = richText.html;\n\t\t\tmode = richText.mode;\n\t\t}\n\t}\n\tconst dataToCopy: ClipboardDataToCopy = {\n\t\tisFromEmptySelection,\n\t\tmulticursorText,\n\t\ttext,\n\t\thtml,\n\t\tmode\n\t};\n\treturn dataToCopy;\n}\n\n/**\n * Every time we write to the clipboard, we record a bit of extra metadata here.\n * Every time we read from the cipboard, if the text matches our last written text,\n * we can fetch the previous metadata.\n */\nexport class InMemoryClipboardMetadataManager {\n\tpublic static readonly INSTANCE = new InMemoryClipboardMetadataManager();\n\n\tprivate _lastState: InMemoryClipboardMetadata | null;\n\n\tconstructor() {\n\t\tthis._lastState = null;\n\t}\n\n\tpublic set(lastCopiedValue: string, data: ClipboardStoredMetadata): void {\n\t\tthis._lastState = { lastCopiedValue, data };\n\t}\n\n\tpublic get(pastedText: string): ClipboardStoredMetadata | null {\n\t\tif (this._lastState && this._lastState.lastCopiedValue === pastedText) {\n\t\t\t// match!\n\t\t\treturn this._lastState.data;\n\t\t}\n\t\tthis._lastState = null;\n\t\treturn null;\n\t}\n}\n\nexport interface ClipboardDataToCopy {\n\tisFromEmptySelection: boolean;\n\tmulticursorText: string[] | null | undefined;\n\ttext: string;\n\thtml: string | null | undefined;\n\tmode: string | null;\n}\n\nexport interface ClipboardStoredMetadata {\n\tversion: 1;\n\tid: string | undefined;\n\tisFromEmptySelection: boolean | undefined;\n\tmulticursorText: string[] | null | undefined;\n\tmode: string | null;\n}\n\nexport const CopyOptions = {\n\tforceCopyWithSyntaxHighlighting: false\n};\n\ninterface InMemoryClipboardMetadata {\n\tlastCopiedValue: string;\n\tdata: ClipboardStoredMetadata;\n}\n\nexport const ClipboardEventUtils = {\n\n\tgetTextData(clipboardData: DataTransfer): [string, ClipboardStoredMetadata | null] {\n\t\tconst text = clipboardData.getData(Mimes.text);\n\t\tlet metadata: ClipboardStoredMetadata | null = null;\n\t\tconst rawmetadata = clipboardData.getData('vscode-editor-data');\n\t\tif (typeof rawmetadata === 'string') {\n\t\t\ttry {\n\t\t\t\tmetadata = <ClipboardStoredMetadata>JSON.parse(rawmetadata);\n\t\t\t\tif (metadata.version !== 1) {\n\t\t\t\t\tmetadata = null;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// no problem!\n\t\t\t}\n\t\t}\n\t\tif (text.length === 0 && metadata === null && clipboardData.files.length > 0) {\n\t\t\t// no textual data pasted, generate text from file names\n\t\t\tconst files: File[] = Array.prototype.slice.call(clipboardData.files, 0);\n\t\t\treturn [files.map(file => file.name).join('\\n'), null];\n\t\t}\n\t\treturn [text, metadata];\n\t},\n\n\tsetTextData(clipboardData: DataTransfer, text: string, html: string | null | undefined, metadata: ClipboardStoredMetadata): void {\n\t\tclipboardData.setData(Mimes.text, text);\n\t\tif (typeof html === 'string') {\n\t\t\tclipboardData.setData('text/html', html);\n\t\t}\n\t\tclipboardData.setData('vscode-editor-data', JSON.stringify(metadata));\n\t}\n};\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/controller/editContext/clipboardUtils.ts","vs/editor/browser/controller/editContext/clipboardUtils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,OAAO,EAAe,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,UAAU,kCAAkC,CAAC,CAAiB,EAAE,OAAoB,EAAE,UAAuB,EAAE,SAAkB;IACtI,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACpC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC;IAC9C,IAAI,EAAE,GAAuB,SAAS,CAAC;IACvC,IAAI,UAAU,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC9C,EAAE,GAAG,YAAY,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,kCAAkC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;IAE7G,QAAQ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,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAC5D,IAAI,QAAQ,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;oBAC5B,QAAQ,GAAG,IAAI,CAAC;gBACjB,CAAC;YACF,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,cAAc;YACf,CAAC;QACF,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9E,wDAAwD;YACxD,MAAM,KAAK,GAAW,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACzE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,WAAW,CAAC,aAA2B,EAAE,IAAY,EAAE,IAA+B,EAAE,QAAiC;QACxH,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC9B,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC;QACD,aAAa,CAAC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,CAAC;CACD,CAAC","file":"clipboardUtils.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 *--------------------------------------------------------------------------------------------*/\nimport { IViewModel } from '../../../common/viewModel.js';\nimport { Range } from '../../../common/core/range.js';\nimport { isWindows } from '../../../../base/common/platform.js';\nimport { Mimes } from '../../../../base/common/mime.js';\nimport { ViewContext } from '../../../common/viewModel/viewContext.js';\nimport { ILogService, LogLevel } from '../../../../platform/log/common/log.js';\nimport { EditorOption, IComputedEditorOptions } from '../../../common/config/editorOptions.js';\nimport { generateUuid } from '../../../../base/common/uuid.js';\n\nexport function ensureClipboardGetsEditorSelection(e: ClipboardEvent, context: ViewContext, logService: ILogService, isFirefox: boolean): void {\n\tconst viewModel = context.viewModel;\n\tconst options = context.configuration.options;\n\tlet id: string | undefined = undefined;\n\tif (logService.getLevel() === LogLevel.Trace) {\n\t\tid = generateUuid();\n\t}\n\n\tconst { dataToCopy, storedMetadata } = generateDataToCopyAndStoreInMemory(viewModel, options, id, isFirefox);\n\n\t// !!!!!\n\t// This is a workaround for what we think is an Electron bug where\n\t// execCommand('copy') does not always work (it does not fire a clipboard event)\n\t// !!!!!\n\t// We signal that we have executed a copy command\n\tCopyOptions.electronBugWorkaroundCopyEventHasFired = true;\n\n\te.preventDefault();\n\tif (e.clipboardData) {\n\t\tClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);\n\t}\n\tlogService.trace('ensureClipboardGetsEditorSelection with id : ', id, ' with text.length: ', dataToCopy.text.length);\n}\n\nexport function generateDataToCopyAndStoreInMemory(viewModel: IViewModel, options: IComputedEditorOptions, id: string | undefined, isFirefox: boolean) {\n\tconst emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard);\n\tconst copyWithSyntaxHighlighting = options.get(EditorOption.copyWithSyntaxHighlighting);\n\tconst selections = viewModel.getCursorStates().map(cursorState => cursorState.modelState.selection);\n\tconst dataToCopy = getDataToCopy(viewModel, selections, emptySelectionClipboard, copyWithSyntaxHighlighting);\n\tconst storedMetadata: ClipboardStoredMetadata = {\n\t\tversion: 1,\n\t\tid,\n\t\tisFromEmptySelection: dataToCopy.isFromEmptySelection,\n\t\tmulticursorText: dataToCopy.multicursorText,\n\t\tmode: dataToCopy.mode\n\t};\n\tInMemoryClipboardMetadataManager.INSTANCE.set(\n\t\t// When writing \"LINE\\r\\n\" to the clipboard and then pasting,\n\t\t// Firefox pastes \"LINE\\n\", so let's work around this quirk\n\t\t(isFirefox ? dataToCopy.text.replace(/\\r\\n/g, '\\n') : dataToCopy.text),\n\t\tstoredMetadata\n\t);\n\treturn { dataToCopy, storedMetadata };\n}\n\nfunction getDataToCopy(viewModel: IViewModel, modelSelections: Range[], emptySelectionClipboard: boolean, copyWithSyntaxHighlighting: boolean): ClipboardDataToCopy {\n\tconst rawTextToCopy = viewModel.getPlainTextToCopy(modelSelections, emptySelectionClipboard, isWindows);\n\tconst newLineCharacter = viewModel.model.getEOL();\n\n\tconst isFromEmptySelection = (emptySelectionClipboard && modelSelections.length === 1 && modelSelections[0].isEmpty());\n\tconst multicursorText = (Array.isArray(rawTextToCopy) ? rawTextToCopy : null);\n\tconst text = (Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy);\n\n\tlet html: string | null | undefined = undefined;\n\tlet mode: string | null = null;\n\tif (CopyOptions.forceCopyWithSyntaxHighlighting || (copyWithSyntaxHighlighting && text.length < 65536)) {\n\t\tconst richText = viewModel.getRichTextToCopy(modelSelections, emptySelectionClipboard);\n\t\tif (richText) {\n\t\t\thtml = richText.html;\n\t\t\tmode = richText.mode;\n\t\t}\n\t}\n\tconst dataToCopy: ClipboardDataToCopy = {\n\t\tisFromEmptySelection,\n\t\tmulticursorText,\n\t\ttext,\n\t\thtml,\n\t\tmode\n\t};\n\treturn dataToCopy;\n}\n\nexport interface IPasteData {\n\ttext: string;\n\tpasteOnNewLine: boolean;\n\tmulticursorText: string[] | null;\n\tmode: string | null;\n}\n\nexport function computePasteData(e: ClipboardEvent, context: ViewContext, logService: ILogService): IPasteData | undefined {\n\te.preventDefault();\n\tif (!e.clipboardData) {\n\t\treturn;\n\t}\n\tlet [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);\n\tlogService.trace('computePasteData with id : ', metadata?.id, ' with text.length: ', text.length);\n\tif (!text) {\n\t\treturn;\n\t}\n\tPasteOptions.electronBugWorkaroundPasteEventHasFired = true;\n\tmetadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);\n\treturn getPasteDataFromMetadata(text, metadata, context);\n}\n\nexport function getPasteDataFromMetadata(text: string, metadata: ClipboardStoredMetadata | null, context: ViewContext): IPasteData {\n\tlet pasteOnNewLine = false;\n\tlet multicursorText: string[] | null = null;\n\tlet mode: string | null = null;\n\tif (metadata) {\n\t\tconst options = context.configuration.options;\n\t\tconst emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard);\n\t\tpasteOnNewLine = emptySelectionClipboard && !!metadata.isFromEmptySelection;\n\t\tmulticursorText = typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null;\n\t\tmode = metadata.mode;\n\t}\n\treturn { text, pasteOnNewLine, multicursorText, mode };\n}\n/**\n * Every time we write to the clipboard, we record a bit of extra metadata here.\n * Every time we read from the cipboard, if the text matches our last written text,\n * we can fetch the previous metadata.\n */\nexport class InMemoryClipboardMetadataManager {\n\tpublic static readonly INSTANCE = new InMemoryClipboardMetadataManager();\n\n\tprivate _lastState: InMemoryClipboardMetadata | null;\n\n\tconstructor() {\n\t\tthis._lastState = null;\n\t}\n\n\tpublic set(lastCopiedValue: string, data: ClipboardStoredMetadata): void {\n\t\tthis._lastState = { lastCopiedValue, data };\n\t}\n\n\tpublic get(pastedText: string): ClipboardStoredMetadata | null {\n\t\tif (this._lastState && this._lastState.lastCopiedValue === pastedText) {\n\t\t\t// match!\n\t\t\treturn this._lastState.data;\n\t\t}\n\t\tthis._lastState = null;\n\t\treturn null;\n\t}\n}\n\nexport interface ClipboardDataToCopy {\n\tisFromEmptySelection: boolean;\n\tmulticursorText: string[] | null | undefined;\n\ttext: string;\n\thtml: string | null | undefined;\n\tmode: string | null;\n}\n\nexport interface ClipboardStoredMetadata {\n\tversion: 1;\n\tid: string | undefined;\n\tisFromEmptySelection: boolean | undefined;\n\tmulticursorText: string[] | null | undefined;\n\tmode: string | null;\n}\n\nexport const CopyOptions = {\n\tforceCopyWithSyntaxHighlighting: false,\n\telectronBugWorkaroundCopyEventHasFired: false\n};\n\nexport const PasteOptions = {\n\telectronBugWorkaroundPasteEventHasFired: false\n};\n\ninterface InMemoryClipboardMetadata {\n\tlastCopiedValue: string;\n\tdata: ClipboardStoredMetadata;\n}\n\nexport const ClipboardEventUtils = {\n\n\tgetTextData(clipboardData: DataTransfer): [string, ClipboardStoredMetadata | null] {\n\t\tconst text = clipboardData.getData(Mimes.text);\n\t\tlet metadata: ClipboardStoredMetadata | null = null;\n\t\tconst rawmetadata = clipboardData.getData('vscode-editor-data');\n\t\tif (typeof rawmetadata === 'string') {\n\t\t\ttry {\n\t\t\t\tmetadata = <ClipboardStoredMetadata>JSON.parse(rawmetadata);\n\t\t\t\tif (metadata.version !== 1) {\n\t\t\t\t\tmetadata = null;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// no problem!\n\t\t\t}\n\t\t}\n\t\tif (text.length === 0 && metadata === null && clipboardData.files.length > 0) {\n\t\t\t// no textual data pasted, generate text from file names\n\t\t\tconst files: File[] = Array.prototype.slice.call(clipboardData.files, 0);\n\t\t\treturn [files.map(file => file.name).join('\\n'), null];\n\t\t}\n\t\treturn [text, metadata];\n\t},\n\n\tsetTextData(clipboardData: DataTransfer, text: string, html: string | null | undefined, metadata: ClipboardStoredMetadata): void {\n\t\tclipboardData.setData(Mimes.text, text);\n\t\tif (typeof html === 'string') {\n\t\t\tclipboardData.setData('text/html', html);\n\t\t}\n\t\tclipboardData.setData('vscode-editor-data', JSON.stringify(metadata));\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 *--------------------------------------------------------------------------------------------*/\nimport { IViewModel } from '../../../common/viewModel.js';\nimport { Range } from '../../../common/core/range.js';\nimport { isWindows } from '../../../../base/common/platform.js';\nimport { Mimes } from '../../../../base/common/mime.js';\nimport { ViewContext } from '../../../common/viewModel/viewContext.js';\nimport { ILogService, LogLevel } from '../../../../platform/log/common/log.js';\nimport { EditorOption, IComputedEditorOptions } from '../../../common/config/editorOptions.js';\nimport { generateUuid } from '../../../../base/common/uuid.js';\n\nexport function ensureClipboardGetsEditorSelection(e: ClipboardEvent, context: ViewContext, logService: ILogService, isFirefox: boolean): void {\n\tconst viewModel = context.viewModel;\n\tconst options = context.configuration.options;\n\tlet id: string | undefined = undefined;\n\tif (logService.getLevel() === LogLevel.Trace) {\n\t\tid = generateUuid();\n\t}\n\n\tconst { dataToCopy, storedMetadata } = generateDataToCopyAndStoreInMemory(viewModel, options, id, isFirefox);\n\n\t// !!!!!\n\t// This is a workaround for what we think is an Electron bug where\n\t// execCommand('copy') does not always work (it does not fire a clipboard event)\n\t// !!!!!\n\t// We signal that we have executed a copy command\n\tCopyOptions.electronBugWorkaroundCopyEventHasFired = true;\n\n\te.preventDefault();\n\tif (e.clipboardData) {\n\t\tClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);\n\t}\n\tlogService.trace('ensureClipboardGetsEditorSelection with id : ', id, ' with text.length: ', dataToCopy.text.length);\n}\n\nexport function generateDataToCopyAndStoreInMemory(viewModel: IViewModel, options: IComputedEditorOptions, id: string | undefined, isFirefox: boolean) {\n\tconst emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard);\n\tconst copyWithSyntaxHighlighting = options.get(EditorOption.copyWithSyntaxHighlighting);\n\tconst selections = viewModel.getCursorStates().map(cursorState => cursorState.modelState.selection);\n\tconst dataToCopy = getDataToCopy(viewModel, selections, emptySelectionClipboard, copyWithSyntaxHighlighting);\n\tconst storedMetadata: ClipboardStoredMetadata = {\n\t\tversion: 1,\n\t\tid,\n\t\tisFromEmptySelection: dataToCopy.isFromEmptySelection,\n\t\tmulticursorText: dataToCopy.multicursorText,\n\t\tmode: dataToCopy.mode\n\t};\n\tInMemoryClipboardMetadataManager.INSTANCE.set(\n\t\t// When writing \"LINE\\r\\n\" to the clipboard and then pasting,\n\t\t// Firefox pastes \"LINE\\n\", so let's work around this quirk\n\t\t(isFirefox ? dataToCopy.text.replace(/\\r\\n/g, '\\n') : dataToCopy.text),\n\t\tstoredMetadata\n\t);\n\treturn { dataToCopy, storedMetadata };\n}\n\nfunction getDataToCopy(viewModel: IViewModel, modelSelections: Range[], emptySelectionClipboard: boolean, copyWithSyntaxHighlighting: boolean): ClipboardDataToCopy {\n\tconst rawTextToCopy = viewModel.getPlainTextToCopy(modelSelections, emptySelectionClipboard, isWindows);\n\tconst newLineCharacter = viewModel.model.getEOL();\n\n\tconst isFromEmptySelection = (emptySelectionClipboard && modelSelections.length === 1 && modelSelections[0].isEmpty());\n\tconst multicursorText = (Array.isArray(rawTextToCopy) ? rawTextToCopy : null);\n\tconst text = (Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy);\n\n\tlet html: string | null | undefined = undefined;\n\tlet mode: string | null = null;\n\tif (CopyOptions.forceCopyWithSyntaxHighlighting || (copyWithSyntaxHighlighting && text.length < 65536)) {\n\t\tconst richText = viewModel.getRichTextToCopy(modelSelections, emptySelectionClipboard);\n\t\tif (richText) {\n\t\t\thtml = richText.html;\n\t\t\tmode = richText.mode;\n\t\t}\n\t}\n\tconst dataToCopy: ClipboardDataToCopy = {\n\t\tisFromEmptySelection,\n\t\tmulticursorText,\n\t\ttext,\n\t\thtml,\n\t\tmode\n\t};\n\treturn dataToCopy;\n}\n\nexport interface IPasteData {\n\ttext: string;\n\tpasteOnNewLine: boolean;\n\tmulticursorText: string[] | null;\n\tmode: string | null;\n}\n\nexport function computePasteData(e: ClipboardEvent, context: ViewContext, logService: ILogService): IPasteData | undefined {\n\te.preventDefault();\n\tif (!e.clipboardData) {\n\t\treturn;\n\t}\n\tlet [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);\n\tlogService.trace('computePasteData with id : ', metadata?.id, ' with text.length: ', text.length);\n\tif (!text) {\n\t\treturn;\n\t}\n\tPasteOptions.electronBugWorkaroundPasteEventHasFired = true;\n\tmetadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);\n\treturn getPasteDataFromMetadata(text, metadata, context);\n}\n\nexport function getPasteDataFromMetadata(text: string, metadata: ClipboardStoredMetadata | null, context: ViewContext): IPasteData {\n\tlet pasteOnNewLine = false;\n\tlet multicursorText: string[] | null = null;\n\tlet mode: string | null = null;\n\tif (metadata) {\n\t\tconst options = context.configuration.options;\n\t\tconst emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard);\n\t\tpasteOnNewLine = emptySelectionClipboard && !!metadata.isFromEmptySelection;\n\t\tmulticursorText = typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null;\n\t\tmode = metadata.mode;\n\t}\n\treturn { text, pasteOnNewLine, multicursorText, mode };\n}\n/**\n * Every time we write to the clipboard, we record a bit of extra metadata here.\n * Every time we read from the cipboard, if the text matches our last written text,\n * we can fetch the previous metadata.\n */\nexport class InMemoryClipboardMetadataManager {\n\tpublic static readonly INSTANCE = new InMemoryClipboardMetadataManager();\n\n\tprivate _lastState: InMemoryClipboardMetadata | null;\n\n\tconstructor() {\n\t\tthis._lastState = null;\n\t}\n\n\tpublic set(lastCopiedValue: string, data: ClipboardStoredMetadata): void {\n\t\tthis._lastState = { lastCopiedValue, data };\n\t}\n\n\tpublic get(pastedText: string): ClipboardStoredMetadata | null {\n\t\tif (this._lastState && this._lastState.lastCopiedValue === pastedText) {\n\t\t\t// match!\n\t\t\treturn this._lastState.data;\n\t\t}\n\t\tthis._lastState = null;\n\t\treturn null;\n\t}\n}\n\nexport interface ClipboardDataToCopy {\n\tisFromEmptySelection: boolean;\n\tmulticursorText: string[] | null | undefined;\n\ttext: string;\n\thtml: string | null | undefined;\n\tmode: string | null;\n}\n\nexport interface ClipboardStoredMetadata {\n\tversion: 1;\n\tid: string | undefined;\n\tisFromEmptySelection: boolean | undefined;\n\tmulticursorText: string[] | null | undefined;\n\tmode: string | null;\n}\n\nexport const CopyOptions = {\n\tforceCopyWithSyntaxHighlighting: false,\n\telectronBugWorkaroundCopyEventHasFired: false\n};\n\nexport const PasteOptions = {\n\telectronBugWorkaroundPasteEventHasFired: false\n};\n\ninterface InMemoryClipboardMetadata {\n\tlastCopiedValue: string;\n\tdata: ClipboardStoredMetadata;\n}\n\nexport const ClipboardEventUtils = {\n\n\tgetTextData(clipboardData: DataTransfer): [string, ClipboardStoredMetadata | null] {\n\t\tconst text = clipboardData.getData(Mimes.text);\n\t\tlet metadata: ClipboardStoredMetadata | null = null;\n\t\tconst rawmetadata = clipboardData.getData('vscode-editor-data');\n\t\tif (typeof rawmetadata === 'string') {\n\t\t\ttry {\n\t\t\t\tmetadata = <ClipboardStoredMetadata>JSON.parse(rawmetadata);\n\t\t\t\tif (metadata.version !== 1) {\n\t\t\t\t\tmetadata = null;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// no problem!\n\t\t\t}\n\t\t}\n\t\tif (text.length === 0 && metadata === null && clipboardData.files.length > 0) {\n\t\t\t// no textual data pasted, generate text from file names\n\t\t\tconst files: File[] = Array.prototype.slice.call(clipboardData.files, 0);\n\t\t\treturn [files.map(file => file.name).join('\\n'), null];\n\t\t}\n\t\treturn [text, metadata];\n\t},\n\n\tsetTextData(clipboardData: DataTransfer, text: string, html: string | null | undefined, metadata: ClipboardStoredMetadata): void {\n\t\tclipboardData.setData(Mimes.text, text);\n\t\tif (typeof html === 'string') {\n\t\t\tclipboardData.setData('text/html', html);\n\t\t}\n\t\tclipboardData.setData('vscode-editor-data', JSON.stringify(metadata));\n\t}\n};\n"]}
@@ -17,7 +17,7 @@ import { addDisposableListener, getActiveElement, getWindow, getWindowId } from
17
17
  import { FastDomNode } from '../../../../../base/browser/fastDomNode.js';
18
18
  import { StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';
19
19
  import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
20
- import { ClipboardEventUtils, getDataToCopy, InMemoryClipboardMetadataManager } from '../clipboardUtils.js';
20
+ import { ensureClipboardGetsEditorSelection, computePasteData } from '../clipboardUtils.js';
21
21
  import { AbstractEditContext } from '../editContext.js';
22
22
  import { editContextAddDisposableListener, FocusTracker } from './nativeEditContextUtils.js';
23
23
  import { ScreenReaderSupport } from './screenReaderSupport.js';
@@ -30,8 +30,7 @@ import { NativeEditContextRegistry } from './nativeEditContextRegistry.js';
30
30
  import { isHighSurrogate, isLowSurrogate } from '../../../../../base/common/strings.js';
31
31
  import { IME } from '../../../../../base/common/ime.js';
32
32
  import { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';
33
- import { ILogService, LogLevel } from '../../../../../platform/log/common/log.js';
34
- import { generateUuid } from '../../../../../base/common/uuid.js';
33
+ import { ILogService } from '../../../../../platform/log/common/log.js';
35
34
  import { inputLatency } from '../../../../../base/browser/performance.js';
36
35
  // Corresponds to classes in nativeEditContext.css
37
36
  var CompositionClassName;
@@ -80,14 +79,14 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
80
79
  this._screenReaderSupport = this._register(instantiationService.createInstance(ScreenReaderSupport, this.domNode, context, this._viewController));
81
80
  this._register(addDisposableListener(this.domNode.domNode, 'copy', (e) => {
82
81
  this.logService.trace('NativeEditContext#copy');
83
- this._ensureClipboardGetsEditorSelection(e);
82
+ ensureClipboardGetsEditorSelection(e, this._context, this.logService, isFirefox);
84
83
  }));
85
84
  this._register(addDisposableListener(this.domNode.domNode, 'cut', (e) => {
86
85
  this.logService.trace('NativeEditContext#cut');
87
86
  // Pretend here we touched the text area, as the `cut` event will most likely
88
87
  // result in a `selectionchange` event which we want to ignore
89
88
  this._screenReaderSupport.onWillCut();
90
- this._ensureClipboardGetsEditorSelection(e);
89
+ ensureClipboardGetsEditorSelection(e, this._context, this.logService, isFirefox);
91
90
  this.logService.trace('NativeEditContext#cut (before viewController.cut)');
92
91
  this._viewController.cut();
93
92
  }));
@@ -106,28 +105,12 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
106
105
  }));
107
106
  this._register(addDisposableListener(this.domNode.domNode, 'paste', (e) => {
108
107
  this.logService.trace('NativeEditContext#paste');
109
- e.preventDefault();
110
- if (!e.clipboardData) {
108
+ const pasteData = computePasteData(e, this._context, this.logService);
109
+ if (!pasteData) {
111
110
  return;
112
111
  }
113
- let [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
114
- this.logService.trace('NativeEditContext#paste with id : ', metadata?.id, ' with text.length: ', text.length);
115
- if (!text) {
116
- return;
117
- }
118
- metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
119
- let pasteOnNewLine = false;
120
- let multicursorText = null;
121
- let mode = null;
122
- if (metadata) {
123
- const options = this._context.configuration.options;
124
- const emptySelectionClipboard = options.get(45 /* EditorOption.emptySelectionClipboard */);
125
- pasteOnNewLine = emptySelectionClipboard && !!metadata.isFromEmptySelection;
126
- multicursorText = typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null;
127
- mode = metadata.mode;
128
- }
129
112
  this.logService.trace('NativeEditContext#paste (before viewController.paste)');
130
- this._viewController.paste(text, pasteOnNewLine, multicursorText, mode);
113
+ this._viewController.paste(pasteData.text, pasteData.pasteOnNewLine, pasteData.multicursorText, pasteData.mode);
131
114
  }));
132
115
  // Edit context events
133
116
  this._register(editContextAddDisposableListener(this._editContext, 'textformatupdate', (e) => this._handleTextFormatUpdate(e)));
@@ -488,33 +471,6 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
488
471
  }
489
472
  this._editContext.updateCharacterBounds(e.rangeStart, characterBounds);
490
473
  }
491
- _ensureClipboardGetsEditorSelection(e) {
492
- const options = this._context.configuration.options;
493
- const emptySelectionClipboard = options.get(45 /* EditorOption.emptySelectionClipboard */);
494
- const copyWithSyntaxHighlighting = options.get(31 /* EditorOption.copyWithSyntaxHighlighting */);
495
- const selections = this._context.viewModel.getCursorStates().map(cursorState => cursorState.modelState.selection);
496
- const dataToCopy = getDataToCopy(this._context.viewModel, selections, emptySelectionClipboard, copyWithSyntaxHighlighting);
497
- let id = undefined;
498
- if (this.logService.getLevel() === LogLevel.Trace) {
499
- id = generateUuid();
500
- }
501
- const storedMetadata = {
502
- version: 1,
503
- id,
504
- isFromEmptySelection: dataToCopy.isFromEmptySelection,
505
- multicursorText: dataToCopy.multicursorText,
506
- mode: dataToCopy.mode
507
- };
508
- InMemoryClipboardMetadataManager.INSTANCE.set(
509
- // When writing "LINE\r\n" to the clipboard and then pasting,
510
- // Firefox pastes "LINE\n", so let's work around this quirk
511
- (isFirefox ? dataToCopy.text.replace(/\r\n/g, '\n') : dataToCopy.text), storedMetadata);
512
- e.preventDefault();
513
- if (e.clipboardData) {
514
- ClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);
515
- }
516
- this.logService.trace('NativeEditContext#_ensureClipboardGetsEditorSelectios with id : ', id, ' with text.length: ', dataToCopy.text.length);
517
- }
518
474
  };
519
475
  NativeEditContext = __decorate([
520
476
  __param(5, IInstantiationService),