@deepseek-harness-tui/dsh-tui 0.11.1 → 0.11.2

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 (427) hide show
  1. package/README.md +50 -20
  2. package/assets/whale-girl/whale-girl-dark.png +0 -0
  3. package/assets/whale-girl/whale-girl-happy.png +0 -0
  4. package/assets/whale-girl/whale-girl.png +0 -0
  5. package/bin/dsh-tui.js +63 -3
  6. package/cordis.patch.yml +39 -17
  7. package/cordis.yml +3 -2
  8. package/lib/settings.json +1272 -0
  9. package/lib/types/adapter/channel/ui-policy.d.ts +9 -2
  10. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  11. package/lib/types/adapter/channel/ui-policy.js +13 -0
  12. package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
  13. package/lib/types/adapter/kernel/replay.js +2 -0
  14. package/lib/types/adapter/ports/channel-display.d.ts +12 -0
  15. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  16. package/lib/types/adapter/ports/channel-session.d.ts +38 -0
  17. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  18. package/lib/types/adapter/ports/channel-settings.d.ts +12 -0
  19. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  20. package/lib/types/adapter/ports/channel-ui.d.ts +46 -4
  21. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  22. package/lib/types/adapter/ports/channel-view.d.ts +43 -0
  23. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  24. package/lib/types/commands.d.ts.map +1 -1
  25. package/lib/types/commands.js +2 -0
  26. package/lib/types/components/BalanceReportRow.d.ts +10 -2
  27. package/lib/types/components/BalanceReportRow.d.ts.map +1 -1
  28. package/lib/types/components/BalanceReportRow.js +18 -4
  29. package/lib/types/components/CompactionStatusRow.d.ts +24 -0
  30. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -0
  31. package/lib/types/components/CompactionStatusRow.js +72 -0
  32. package/lib/types/components/GoalTodoPanel.js +2 -2
  33. package/lib/types/components/HelpMenu.d.ts +2 -2
  34. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  35. package/lib/types/components/HelpMenu.js +5 -4
  36. package/lib/types/components/InlineMathParagraph.d.ts +22 -0
  37. package/lib/types/components/InlineMathParagraph.d.ts.map +1 -0
  38. package/lib/types/components/InlineMathParagraph.js +178 -0
  39. package/lib/types/components/LogoV2.d.ts +41 -3
  40. package/lib/types/components/LogoV2.d.ts.map +1 -1
  41. package/lib/types/components/LogoV2.js +148 -24
  42. package/lib/types/components/Markdown.d.ts +10 -3
  43. package/lib/types/components/Markdown.d.ts.map +1 -1
  44. package/lib/types/components/Markdown.js +47 -14
  45. package/lib/types/components/MathBlock.d.ts +13 -0
  46. package/lib/types/components/MathBlock.d.ts.map +1 -0
  47. package/lib/types/components/MathBlock.js +136 -0
  48. package/lib/types/components/MessageList.d.ts +10 -1
  49. package/lib/types/components/MessageList.d.ts.map +1 -1
  50. package/lib/types/components/MessageList.js +13 -4
  51. package/lib/types/components/MigratePicker.d.ts +30 -0
  52. package/lib/types/components/MigratePicker.d.ts.map +1 -0
  53. package/lib/types/components/MigratePicker.js +38 -0
  54. package/lib/types/components/PromptInput.d.ts +17 -0
  55. package/lib/types/components/PromptInput.d.ts.map +1 -1
  56. package/lib/types/components/PromptInput.js +48 -7
  57. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  58. package/lib/types/components/SplitDiffView.js +2 -1
  59. package/lib/types/components/StarPrompt.d.ts +53 -0
  60. package/lib/types/components/StarPrompt.d.ts.map +1 -0
  61. package/lib/types/components/StarPrompt.js +281 -0
  62. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
  63. package/lib/types/components/StreamingMarkdown.js +20 -3
  64. package/lib/types/components/TimelineRail.d.ts.map +1 -1
  65. package/lib/types/components/TimelineRail.js +9 -1
  66. package/lib/types/components/Whale.d.ts +17 -8
  67. package/lib/types/components/Whale.d.ts.map +1 -1
  68. package/lib/types/components/Whale.js +25 -15
  69. package/lib/types/components/WhaleGirl.d.ts +29 -0
  70. package/lib/types/components/WhaleGirl.d.ts.map +1 -0
  71. package/lib/types/components/WhaleGirl.js +32 -0
  72. package/lib/types/components/WorkingSpinner.d.ts +4 -1
  73. package/lib/types/components/WorkingSpinner.d.ts.map +1 -1
  74. package/lib/types/components/WorkingSpinner.js +2 -2
  75. package/lib/types/components/bigfont.d.ts +47 -18
  76. package/lib/types/components/bigfont.d.ts.map +1 -1
  77. package/lib/types/components/bigfont.js +55 -40
  78. package/lib/types/components/design-system/ThemeProvider.d.ts +6 -0
  79. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  80. package/lib/types/components/design-system/ThemeProvider.js +40 -1
  81. package/lib/types/components/maidPortrait.d.ts +44 -0
  82. package/lib/types/components/maidPortrait.d.ts.map +1 -0
  83. package/lib/types/components/maidPortrait.js +178 -0
  84. package/lib/types/components/mathPreview.d.ts +25 -0
  85. package/lib/types/components/mathPreview.d.ts.map +1 -0
  86. package/lib/types/components/mathPreview.js +48 -0
  87. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  88. package/lib/types/components/messages/AssistantThinkingMessage.js +2 -1
  89. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  90. package/lib/types/components/messages/AssistantToolUseMessage.js +3 -2
  91. package/lib/types/components/messages/TranscriptImages.d.ts.map +1 -1
  92. package/lib/types/components/messages/TranscriptImages.js +11 -1
  93. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +14 -2
  94. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  95. package/lib/types/components/questions/AskUserQuestionPanel.js +80 -38
  96. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  97. package/lib/types/components/questions/PlanReviewPanel.js +3 -3
  98. package/lib/types/components/sessions/ForeignSessionRow.d.ts +34 -0
  99. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -0
  100. package/lib/types/components/sessions/ForeignSessionRow.js +43 -0
  101. package/lib/types/components/sessions/SourceTabs.d.ts +52 -0
  102. package/lib/types/components/sessions/SourceTabs.d.ts.map +1 -0
  103. package/lib/types/components/sessions/SourceTabs.js +70 -0
  104. package/lib/types/components/splashEggs.d.ts +56 -0
  105. package/lib/types/components/splashEggs.d.ts.map +1 -0
  106. package/lib/types/components/splashEggs.js +67 -0
  107. package/lib/types/components/splashFonts.d.ts +119 -0
  108. package/lib/types/components/splashFonts.d.ts.map +1 -0
  109. package/lib/types/components/splashFonts.js +267 -0
  110. package/lib/types/components/splashLayout.d.ts +41 -0
  111. package/lib/types/components/splashLayout.d.ts.map +1 -0
  112. package/lib/types/components/splashLayout.js +40 -0
  113. package/lib/types/components/whaleGirlSprite.d.ts +17 -0
  114. package/lib/types/components/whaleGirlSprite.d.ts.map +1 -0
  115. package/lib/types/components/whaleGirlSprite.js +47 -0
  116. package/lib/types/deepseekPricing.d.ts +74 -0
  117. package/lib/types/deepseekPricing.d.ts.map +1 -1
  118. package/lib/types/deepseekPricing.js +110 -11
  119. package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
  120. package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/channel/action-readiness.js +6 -1
  122. package/lib/types/dsh-adapter/channel/background-action.d.ts +1 -0
  123. package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/channel/background-action.js +1 -0
  125. package/lib/types/dsh-adapter/channel/binding-events.d.ts +8 -9
  126. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/channel/binding-events.js +69 -21
  128. package/lib/types/dsh-adapter/channel/compaction.d.ts +2 -1
  129. package/lib/types/dsh-adapter/channel/compaction.d.ts.map +1 -1
  130. package/lib/types/dsh-adapter/channel/compaction.js +35 -2
  131. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/channel/local-actions.js +6 -1
  133. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  134. package/lib/types/dsh-adapter/channel/model-switch.js +5 -1
  135. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  136. package/lib/types/dsh-adapter/channel/paths.js +7 -1
  137. package/lib/types/dsh-adapter/channel/preferences.d.ts +1 -1
  138. package/lib/types/dsh-adapter/channel/preferences.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/channel/preferences.js +16 -0
  140. package/lib/types/dsh-adapter/channel/projection.d.ts +1 -2
  141. package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
  142. package/lib/types/dsh-adapter/channel/projection.js +127 -17
  143. package/lib/types/dsh-adapter/channel/question-record.d.ts +76 -0
  144. package/lib/types/dsh-adapter/channel/question-record.d.ts.map +1 -0
  145. package/lib/types/dsh-adapter/channel/question-record.js +107 -0
  146. package/lib/types/dsh-adapter/channel/session-lineage.d.ts +42 -0
  147. package/lib/types/dsh-adapter/channel/session-lineage.d.ts.map +1 -0
  148. package/lib/types/dsh-adapter/channel/session-lineage.js +51 -0
  149. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +2 -0
  150. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  151. package/lib/types/dsh-adapter/channel/session-live-adoption.js +9 -3
  152. package/lib/types/dsh-adapter/channel/session-metadata.d.ts +2 -1
  153. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/channel/session-metadata.js +39 -7
  155. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  156. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/channel/session-reset.js +7 -0
  158. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -0
  159. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  160. package/lib/types/dsh-adapter/channel/session-resume.js +4 -2
  161. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  162. package/lib/types/dsh-adapter/channel/settings-host.js +8 -0
  163. package/lib/types/dsh-adapter/channel/state.d.ts +14 -1
  164. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  165. package/lib/types/dsh-adapter/channel/state.js +6 -1
  166. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +30 -35
  167. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  168. package/lib/types/dsh-adapter/channel/subagent-projection.js +138 -4
  169. package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
  170. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  171. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/channel.js +19 -4
  173. package/lib/types/dsh-adapter/compat/messages.d.ts +6 -0
  174. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/compat/messages.js +9 -0
  176. package/lib/types/dsh-adapter/contract.d.ts +5 -5
  177. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/contract.js +8 -6
  179. package/lib/types/dsh-adapter/index.d.ts +36 -1
  180. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  181. package/lib/types/dsh-adapter/index.js +22 -6
  182. package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts +3 -0
  183. package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts.map +1 -0
  184. package/lib/types/dsh-adapter/migrate/adapters/claude-code.js +131 -0
  185. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts +17 -0
  186. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts.map +1 -0
  187. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.js +329 -0
  188. package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts +3 -0
  189. package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts.map +1 -0
  190. package/lib/types/dsh-adapter/migrate/adapters/codex.js +102 -0
  191. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts +16 -0
  192. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts.map +1 -0
  193. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.js +289 -0
  194. package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts +3 -0
  195. package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts.map +1 -0
  196. package/lib/types/dsh-adapter/migrate/adapters/grok-build.js +117 -0
  197. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts +13 -0
  198. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts.map +1 -0
  199. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.js +178 -0
  200. package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts +3 -0
  201. package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts.map +1 -0
  202. package/lib/types/dsh-adapter/migrate/adapters/omp.js +133 -0
  203. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts +60 -0
  204. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts.map +1 -0
  205. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.js +178 -0
  206. package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts +8 -0
  207. package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts.map +1 -0
  208. package/lib/types/dsh-adapter/migrate/adapters/scan.js +40 -0
  209. package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts +3 -0
  210. package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts.map +1 -0
  211. package/lib/types/dsh-adapter/migrate/adapters/zcode.js +93 -0
  212. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts +9 -0
  213. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts.map +1 -0
  214. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.js +89 -0
  215. package/lib/types/dsh-adapter/migrate/bin-path.d.ts +6 -0
  216. package/lib/types/dsh-adapter/migrate/bin-path.d.ts.map +1 -0
  217. package/lib/types/dsh-adapter/migrate/bin-path.js +30 -0
  218. package/lib/types/dsh-adapter/migrate/browse.d.ts +42 -0
  219. package/lib/types/dsh-adapter/migrate/browse.d.ts.map +1 -0
  220. package/lib/types/dsh-adapter/migrate/browse.js +90 -0
  221. package/lib/types/dsh-adapter/migrate/cli.d.ts +9 -0
  222. package/lib/types/dsh-adapter/migrate/cli.d.ts.map +1 -0
  223. package/lib/types/dsh-adapter/migrate/cli.js +106 -0
  224. package/lib/types/dsh-adapter/migrate/import-one.d.ts +89 -0
  225. package/lib/types/dsh-adapter/migrate/import-one.d.ts.map +1 -0
  226. package/lib/types/dsh-adapter/migrate/import-one.js +133 -0
  227. package/lib/types/dsh-adapter/migrate/index.d.ts +35 -0
  228. package/lib/types/dsh-adapter/migrate/index.d.ts.map +1 -0
  229. package/lib/types/dsh-adapter/migrate/index.js +107 -0
  230. package/lib/types/dsh-adapter/migrate/parse/injection.d.ts +40 -0
  231. package/lib/types/dsh-adapter/migrate/parse/injection.d.ts.map +1 -0
  232. package/lib/types/dsh-adapter/migrate/parse/injection.js +127 -0
  233. package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts +28 -0
  234. package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts.map +1 -0
  235. package/lib/types/dsh-adapter/migrate/parse/jsonl.js +40 -0
  236. package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts +28 -0
  237. package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts.map +1 -0
  238. package/lib/types/dsh-adapter/migrate/parse/role-turns.js +50 -0
  239. package/lib/types/dsh-adapter/migrate/parse/title.d.ts +18 -0
  240. package/lib/types/dsh-adapter/migrate/parse/title.d.ts.map +1 -0
  241. package/lib/types/dsh-adapter/migrate/parse/title.js +29 -0
  242. package/lib/types/dsh-adapter/migrate/parse/tools.d.ts +62 -0
  243. package/lib/types/dsh-adapter/migrate/parse/tools.d.ts.map +1 -0
  244. package/lib/types/dsh-adapter/migrate/parse/tools.js +110 -0
  245. package/lib/types/dsh-adapter/migrate/picker.d.ts +64 -0
  246. package/lib/types/dsh-adapter/migrate/picker.d.ts.map +1 -0
  247. package/lib/types/dsh-adapter/migrate/picker.js +86 -0
  248. package/lib/types/dsh-adapter/migrate/recent-agents.d.ts +40 -0
  249. package/lib/types/dsh-adapter/migrate/recent-agents.d.ts.map +1 -0
  250. package/lib/types/dsh-adapter/migrate/recent-agents.js +100 -0
  251. package/lib/types/dsh-adapter/migrate/sessionize.d.ts +39 -0
  252. package/lib/types/dsh-adapter/migrate/sessionize.d.ts.map +1 -0
  253. package/lib/types/dsh-adapter/migrate/sessionize.js +271 -0
  254. package/lib/types/dsh-adapter/migrate/types.d.ts +176 -0
  255. package/lib/types/dsh-adapter/migrate/types.d.ts.map +1 -0
  256. package/lib/types/dsh-adapter/migrate/types.js +11 -0
  257. package/lib/types/dsh-adapter/migrate/uuid.d.ts +7 -0
  258. package/lib/types/dsh-adapter/migrate/uuid.d.ts.map +1 -0
  259. package/lib/types/dsh-adapter/migrate/uuid.js +25 -0
  260. package/lib/types/dsh-adapter/plugin.d.ts +4 -2
  261. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  262. package/lib/types/dsh-adapter/plugin.js +143 -364
  263. package/lib/types/dsh-adapter/providerWizard.d.ts +17 -0
  264. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  265. package/lib/types/dsh-adapter/providerWizard.js +254 -66
  266. package/lib/types/dsh-adapter/questions.d.ts +22 -15
  267. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  268. package/lib/types/dsh-adapter/questions.js +47 -45
  269. package/lib/types/dsh-adapter/sessions/digest.d.ts +11 -6
  270. package/lib/types/dsh-adapter/sessions/digest.d.ts.map +1 -1
  271. package/lib/types/dsh-adapter/sessions/digest.js +20 -13
  272. package/lib/types/dsh-adapter/sessions/frames.d.ts +3 -1
  273. package/lib/types/dsh-adapter/sessions/frames.d.ts.map +1 -1
  274. package/lib/types/dsh-adapter/sessions/frames.js +5 -4
  275. package/lib/types/dsh-adapter/sessions/list.d.ts +6 -1
  276. package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -1
  277. package/lib/types/dsh-adapter/sessions/list.js +188 -164
  278. package/lib/types/dsh-adapter/sessions/recovery.d.ts +16 -0
  279. package/lib/types/dsh-adapter/sessions/recovery.d.ts.map +1 -0
  280. package/lib/types/dsh-adapter/sessions/recovery.js +108 -0
  281. package/lib/types/dsh-adapter/sessions/snapshot.d.ts +7 -0
  282. package/lib/types/dsh-adapter/sessions/snapshot.d.ts.map +1 -0
  283. package/lib/types/dsh-adapter/sessions/snapshot.js +90 -0
  284. package/lib/types/dsh-adapter/sessions/store.d.ts +10 -4
  285. package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -1
  286. package/lib/types/dsh-adapter/sessions/store.js +62 -25
  287. package/lib/types/dsh-adapter/sideQuestion.d.ts +41 -2
  288. package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -1
  289. package/lib/types/dsh-adapter/sideQuestion.js +98 -2
  290. package/lib/types/dsh-adapter/subagents.d.ts +28 -3
  291. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  292. package/lib/types/dsh-adapter/subagents.js +77 -2
  293. package/lib/types/herdr.d.ts +2 -0
  294. package/lib/types/herdr.d.ts.map +1 -1
  295. package/lib/types/herdr.js +9 -3
  296. package/lib/types/i18n.d.ts +424 -42
  297. package/lib/types/i18n.d.ts.map +1 -1
  298. package/lib/types/i18n.js +145 -20
  299. package/lib/types/ink/components/App.d.ts +2 -2
  300. package/lib/types/ink/components/App.d.ts.map +1 -1
  301. package/lib/types/ink/components/App.js +5 -1
  302. package/lib/types/ink/components/Image.d.ts +14 -1
  303. package/lib/types/ink/components/Image.d.ts.map +1 -1
  304. package/lib/types/ink/components/Image.js +2 -2
  305. package/lib/types/ink/events/input-event.js +3 -3
  306. package/lib/types/ink/hooks/use-terminal-images.d.ts +12 -0
  307. package/lib/types/ink/hooks/use-terminal-images.d.ts.map +1 -1
  308. package/lib/types/ink/hooks/use-terminal-images.js +13 -0
  309. package/lib/types/ink/ink.d.ts +6 -0
  310. package/lib/types/ink/ink.d.ts.map +1 -1
  311. package/lib/types/ink/ink.js +16 -1
  312. package/lib/types/ink/kitty-graphics.d.ts +44 -3
  313. package/lib/types/ink/kitty-graphics.d.ts.map +1 -1
  314. package/lib/types/ink/kitty-graphics.js +184 -23
  315. package/lib/types/ink/output.d.ts +24 -2
  316. package/lib/types/ink/output.d.ts.map +1 -1
  317. package/lib/types/ink/output.js +83 -5
  318. package/lib/types/ink/parse-keypress.d.ts +26 -1
  319. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  320. package/lib/types/ink/parse-keypress.js +156 -13
  321. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  322. package/lib/types/ink/render-node-to-output.js +8 -1
  323. package/lib/types/ink/screen.d.ts +24 -0
  324. package/lib/types/ink/screen.d.ts.map +1 -1
  325. package/lib/types/ink/screen.js +89 -0
  326. package/lib/types/ink/selection.d.ts +40 -18
  327. package/lib/types/ink/selection.d.ts.map +1 -1
  328. package/lib/types/ink/selection.js +142 -30
  329. package/lib/types/ink/sixel-codec.d.ts +12 -1
  330. package/lib/types/ink/sixel-codec.d.ts.map +1 -1
  331. package/lib/types/ink/sixel-codec.js +29 -5
  332. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  333. package/lib/types/ink/sixel-graphics.js +5 -3
  334. package/lib/types/ink/styles.d.ts +9 -0
  335. package/lib/types/ink/styles.d.ts.map +1 -1
  336. package/lib/types/ink/terminal-image.d.ts +8 -0
  337. package/lib/types/ink/terminal-image.d.ts.map +1 -1
  338. package/lib/types/ink/terminal-querier.d.ts +7 -1
  339. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  340. package/lib/types/ink/terminal-querier.js +12 -2
  341. package/lib/types/ink/timeline-rail.d.ts +5 -0
  342. package/lib/types/ink/timeline-rail.d.ts.map +1 -1
  343. package/lib/types/math/inline-layout.d.ts +29 -0
  344. package/lib/types/math/inline-layout.d.ts.map +1 -0
  345. package/lib/types/math/inline-layout.js +106 -0
  346. package/lib/types/math/layout.d.ts +58 -0
  347. package/lib/types/math/layout.d.ts.map +1 -0
  348. package/lib/types/math/layout.js +59 -0
  349. package/lib/types/math/renderer.d.ts +64 -0
  350. package/lib/types/math/renderer.d.ts.map +1 -0
  351. package/lib/types/math/renderer.js +256 -0
  352. package/lib/types/screens/Chat.d.ts +14 -1
  353. package/lib/types/screens/Chat.d.ts.map +1 -1
  354. package/lib/types/screens/Chat.js +606 -53
  355. package/lib/types/screens/SessionSupervisor.d.ts +2 -1
  356. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  357. package/lib/types/screens/SessionSupervisor.js +156 -19
  358. package/lib/types/screens/Settings.d.ts.map +1 -1
  359. package/lib/types/screens/Settings.js +49 -11
  360. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  361. package/lib/types/screens/StatusLine.js +45 -15
  362. package/lib/types/screens/chatOverlay.d.ts +5 -0
  363. package/lib/types/screens/chatOverlay.d.ts.map +1 -1
  364. package/lib/types/screens/chatOverlay.js +1 -0
  365. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +47 -0
  366. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -0
  367. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +65 -0
  368. package/lib/types/screens/sessionSupervisor/model.d.ts +12 -0
  369. package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -1
  370. package/lib/types/screens/sessionSupervisor/model.js +26 -0
  371. package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts +107 -0
  372. package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts.map +1 -0
  373. package/lib/types/screens/sessionSupervisor/useForeignSessions.js +312 -0
  374. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +4 -1
  375. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  376. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +97 -14
  377. package/lib/types/sessionHistory.d.ts +2 -2
  378. package/lib/types/sessionHistory.d.ts.map +1 -1
  379. package/lib/types/sessionHistory.js +31 -5
  380. package/lib/types/settings/definitions.d.ts +681 -0
  381. package/lib/types/settings/definitions.d.ts.map +1 -0
  382. package/lib/types/settings/definitions.js +511 -0
  383. package/lib/types/starAction.d.ts +44 -0
  384. package/lib/types/starAction.d.ts.map +1 -0
  385. package/lib/types/starAction.js +52 -0
  386. package/lib/types/terminal-utils/latex.d.ts +10 -0
  387. package/lib/types/terminal-utils/latex.d.ts.map +1 -0
  388. package/lib/types/terminal-utils/latex.js +1417 -0
  389. package/lib/types/terminal-utils/markdown.d.ts +3 -1
  390. package/lib/types/terminal-utils/markdown.d.ts.map +1 -1
  391. package/lib/types/terminal-utils/markdown.js +26 -1
  392. package/lib/types/terminal-utils/math.d.ts +66 -0
  393. package/lib/types/terminal-utils/math.d.ts.map +1 -0
  394. package/lib/types/terminal-utils/math.js +337 -0
  395. package/lib/types/tips.d.ts.map +1 -1
  396. package/lib/types/tips.js +6 -0
  397. package/lib/types/tuiDisplayPrefs.d.ts +67 -0
  398. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  399. package/lib/types/tuiDisplayPrefs.js +59 -0
  400. package/lib/types/ui.d.ts +1 -1
  401. package/lib/types/ui.d.ts.map +1 -1
  402. package/lib/types/ui.js +1 -1
  403. package/lib/types/usageStats.d.ts +98 -0
  404. package/lib/types/usageStats.d.ts.map +1 -0
  405. package/lib/types/usageStats.js +169 -0
  406. package/lib/types/utils/bmp.d.ts +17 -0
  407. package/lib/types/utils/bmp.d.ts.map +1 -0
  408. package/lib/types/utils/bmp.js +154 -0
  409. package/lib/types/utils/clipboard.d.ts +14 -2
  410. package/lib/types/utils/clipboard.d.ts.map +1 -1
  411. package/lib/types/utils/clipboard.js +143 -8
  412. package/lib/types/utils/fold-long-lines.d.ts.map +1 -1
  413. package/lib/types/utils/fold-long-lines.js +2 -1
  414. package/lib/types/utils/keymap.d.ts +4 -1
  415. package/lib/types/utils/keymap.d.ts.map +1 -1
  416. package/lib/types/utils/keymap.js +8 -0
  417. package/lib/types/utils/modifiers.d.ts +4 -3
  418. package/lib/types/utils/modifiers.d.ts.map +1 -1
  419. package/lib/types/utils/modifiers.js +4 -3
  420. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/LICENSE +202 -0
  421. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/NOTICE +20 -0
  422. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/index.d.ts +16 -0
  423. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/bundled-packages.json +4 -0
  424. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs +20 -0
  425. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs.LEGAL.txt +35 -0
  426. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/package.json +29 -0
  427. package/package.json +111 -97
@@ -81,6 +81,13 @@ export type Win32PasteState = {
81
81
  held: ParsedKey[];
82
82
  /** collected paste content while active */
83
83
  buffer: string;
84
+ /**
85
+ * True when the last character appended to `buffer` came from a CR record
86
+ * (Uc=13). Classic conhost spells a pasted CRLF break as a CR record
87
+ * followed by an LF record (Uc=10); the LF half must fold into the CR's
88
+ * newline instead of appending a second one (issue #1090).
89
+ */
90
+ lastWasCarriageReturn: boolean;
84
91
  };
85
92
  export type Win32ProtocolState = {
86
93
  held: ParsedKey[];
@@ -94,6 +101,23 @@ export type KeyParseState = {
94
101
  mode: 'NORMAL' | 'IN_PASTE';
95
102
  incomplete: string;
96
103
  pasteBuffer: string;
104
+ /**
105
+ * Host-injected platform gate: this machine MIGHT run the private win32
106
+ * input mode (`supportsWin32InputMode()`). Read-only — capability alone is
107
+ * not evidence and never lights anything by itself; only an explicit
108
+ * `false` closes the gate, and leaving the field absent keeps the parser's
109
+ * pre-gate behavior for direct callers.
110
+ */
111
+ win32Capable?: boolean;
112
+ /**
113
+ * Lit by successfully decoding a win32 record. Only behind that evidence
114
+ * may a plain `ESC[` fragment extend the hold (see isRecordPrefix).
115
+ */
116
+ win32InputMode?: boolean;
117
+ /** First capture of a buffered win32 record; never renewed by flushes. */
118
+ win32InputStartedAt?: number;
119
+ /** A flushed lone ESC may be followed by an ESC-less record fragment. */
120
+ win32EscFlushedAt?: number;
97
121
  /**
98
122
  * Pending high surrogate from a win32-input-mode record. Uc is a UTF-16
99
123
  * code unit, so supplementary-plane characters (emoji, CJK ext-B) arrive
@@ -149,7 +173,8 @@ export declare const INITIAL_STATE: KeyParseState;
149
173
  * Tokenize and parse a chunk of terminal input into parsed keys, mouse
150
174
  * events, and terminal responses, maintaining paste-mode state.
151
175
  * @param prevState - the state returned by the previous call, or INITIAL_STATE.
152
- * @param input - the input chunk; null flushes the tokenizer's pending input.
176
+ * @param input - the input chunk; null applies the escape timeout (in-flight
177
+ * win32 records keep their bounded recovery grace).
153
178
  * @returns the parsed inputs plus the state to pass to the next call.
154
179
  */
155
180
  export declare function parseMultipleKeypresses(prevState: KeyParseState, input?: Buffer | string | null): [ParsedInput[], KeyParseState];
@@ -1 +1 @@
1
- {"version":3,"file":"parse-keypress.d.ts","sourceRoot":"","sources":["../../../src/ink/parse-keypress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAA;AA2LtE,gDAAgD;AAChD,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAA;AAEV;;;GAGG;AACH,MAAM,MAAM,gBAAgB;AAC1B,iEAAiE;AAC/D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;A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d,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;6BAE6B;AAC7B,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,UAAU,CAAA;IAChB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,gBAAgB,CAAA;CAC3B,CAAA;AAED;;0DAE0D;AAC1D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAA;IACb;4DACwD;IACxD,MAAM,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAA;IACX,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;2EAC2E;AAC3E,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAA"}
@@ -5,7 +5,7 @@
5
5
  * then interprets sequences as keypresses.
6
6
  */
7
7
  import { Buffer } from 'buffer';
8
- import { PASTE_END, PASTE_START } from './termio/csi.js';
8
+ import { isCSIFinal, isCSIIntermediate, isCSIParam, PASTE_END, PASTE_START } from './termio/csi.js';
9
9
  import { createTokenizer } from './termio/tokenize.js';
10
10
  // eslint-disable-next-line no-control-regex
11
11
  const META_KEY_CODE_RE = /^(?:\x1b)([a-zA-Z0-9])$/;
@@ -13,6 +13,11 @@ const META_KEY_CODE_RE = /^(?:\x1b)([a-zA-Z0-9])$/;
13
13
  const FN_KEY_RE =
14
14
  // eslint-disable-next-line no-control-regex
15
15
  /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/;
16
+ // Complete CSI framing, including sequences outside our keyboard vocabulary.
17
+ // Keep their identity so InputEvent's unknown-code guard suppresses protocol
18
+ // bytes rather than stripping ESC and inserting the parameters as text.
19
+ // eslint-disable-next-line no-control-regex
20
+ const COMPLETE_CSI_RE = /^\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]$/;
16
21
  // CSI u (kitty keyboard protocol): ESC [ codepoint [; modifier] u
17
22
  // Example: ESC[13;2u = Shift+Enter, ESC[27u = Escape (no modifiers)
18
23
  // Modifier is optional - when absent, defaults to 1 (no modifiers)
@@ -44,6 +49,12 @@ const MODIFY_OTHER_KEYS_RE = /^\x1b\[27;(\d+);(\d+)~/;
44
49
  const WIN32_INPUT_RE = /^\x1b\[([\d;]*)_$/;
45
50
  const WIN32_INPUT_TAIL_RE = /\[\d*;\d*;\d*;[01](?:;\d*){0,2}_/g;
46
51
  const WIN32_INPUT_TAILS_RE = /^(?:\[\d*;\d*;\d*;[01](?:;\d*){0,2}_)+$/;
52
+ const WIN32_INPUT_PREFIX_RE = /^\x1b\[[\d;]*$/;
53
+ const WIN32_INPUT_BODY_PREFIX_RE = /^\x1b\[\d*;\d*;\d*;[01]?(?:;\d*){0,2}$/;
54
+ // A record fits well within 64 bytes (six INPUT_RECORD integer fields).
55
+ // Bound both memory and the time ambiguous digits can be held after ESC.
56
+ const WIN32_INPUT_MAX_LENGTH = 64;
57
+ const WIN32_INPUT_GRACE_MS = 1000;
47
58
  // Prefix of a fragmenting SGR mouse report (`[<btn;col;rowM/m`). ConPTY can
48
59
  // split one report across multiple stdin reads; when App's 50ms escape timer
49
60
  // fires between the fragments, the pieces stop being part of one buffered
@@ -517,6 +528,42 @@ function win32RecordChar(key) {
517
528
  return key.sequence === key.name ? key.name : undefined;
518
529
  }
519
530
  }
531
+ /**
532
+ * Uc field of the raw win32 record behind `key`, or undefined when the key
533
+ * did not come from one (the decomposed stream also carries plain keys).
534
+ */
535
+ function win32RecordUc(key) {
536
+ const match = WIN32_INPUT_RE.exec(key.raw ?? '');
537
+ if (!match)
538
+ return undefined;
539
+ const field = match[1].split(';')[2];
540
+ return field === undefined || field === '' ? 0 : parseInt(field, 10);
541
+ }
542
+ /**
543
+ * Append one paste-body key to the decomposed-paste buffer. Classic conhost
544
+ * spells a pasted CRLF break as two records — CR (Uc=13) then LF (Uc=10) —
545
+ * and the LF must fold into the CR's newline instead of appending a second
546
+ * one (issue #1090). Only a CR record arms the fold, so LF-only text, a lone
547
+ * CR, and ordinary characters (including a real `_`) keep their bytes.
548
+ */
549
+ function appendWin32PasteChar(state, key) {
550
+ const ch = win32RecordChar(key);
551
+ if (ch === undefined)
552
+ return;
553
+ if (ch !== '\n') {
554
+ state.lastWasCarriageReturn = false;
555
+ state.buffer += ch;
556
+ return;
557
+ }
558
+ const uc = win32RecordUc(key);
559
+ if (uc === 10 && state.lastWasCarriageReturn) {
560
+ // LF record closing the CRLF pair: the CR already emitted the newline.
561
+ state.lastWasCarriageReturn = false;
562
+ return;
563
+ }
564
+ state.lastWasCarriageReturn = uc === 13;
565
+ state.buffer += '\n';
566
+ }
520
567
  /**
521
568
  * Feed one translated win32 key through the decomposed-paste matcher.
522
569
  * Returns the keys to emit (empty while holding a candidate prefix or
@@ -537,12 +584,14 @@ function feedWin32Paste(state, key) {
537
584
  if (!state.active) {
538
585
  state.active = true;
539
586
  state.buffer = '';
587
+ state.lastWasCarriageReturn = false;
540
588
  return [];
541
589
  }
542
590
  // End marker complete: the whole paste as a single event.
543
591
  const paste = createPasteKey(state.buffer);
544
592
  state.active = false;
545
593
  state.buffer = '';
594
+ state.lastWasCarriageReturn = false;
546
595
  return [paste];
547
596
  }
548
597
  return [];
@@ -556,13 +605,13 @@ function feedWin32Paste(state, key) {
556
605
  state.matched = 0;
557
606
  if (state.active) {
558
607
  for (const k of held)
559
- state.buffer += win32RecordChar(k) ?? '';
608
+ appendWin32PasteChar(state, k);
560
609
  return feedWin32Paste(state, key);
561
610
  }
562
611
  return [...held, ...feedWin32Paste(state, key)];
563
612
  }
564
613
  if (state.active) {
565
- state.buffer += win32RecordChar(key) ?? '';
614
+ appendWin32PasteChar(state, key);
566
615
  return [];
567
616
  }
568
617
  return [key];
@@ -683,25 +732,86 @@ function inputToString(input) {
683
732
  * Tokenize and parse a chunk of terminal input into parsed keys, mouse
684
733
  * events, and terminal responses, maintaining paste-mode state.
685
734
  * @param prevState - the state returned by the previous call, or INITIAL_STATE.
686
- * @param input - the input chunk; null flushes the tokenizer's pending input.
735
+ * @param input - the input chunk; null applies the escape timeout (in-flight
736
+ * win32 records keep their bounded recovery grace).
687
737
  * @returns the parsed inputs plus the state to pass to the next call.
688
738
  */
689
739
  export function parseMultipleKeypresses(prevState, input = '') {
690
740
  const isFlush = input === null;
691
- const inputString = isFlush ? '' : inputToString(input);
741
+ let inputString = isFlush ? '' : inputToString(input);
692
742
  // Get or create tokenizer
693
743
  const tokenizer = prevState._tokenizer ?? createTokenizer({
694
744
  x10Mouse: true,
695
745
  splitInputControls: true,
696
746
  });
697
- // Tokenize the input
698
- const tokens = isFlush ? tokenizer.flush() : tokenizer.feed(inputString);
747
+ // Keep record framing in the tokenizer, rather than converting a timed-out
748
+ // prefix into a key and trying to scrub its text later (#827). The host
749
+ // capability flag only says the platform MIGHT run the private mode; only a
750
+ // decoded record proves it does, so the two stay separate: a frame whose
751
+ // own shape is already record-specific holds on its own (that is how even
752
+ // the first record survives a split), and anything else needs an open gate
753
+ // plus a lit parser. A lone ESC therefore keeps its 50ms behavior on hosts
754
+ // that ignore DECSET 9001, and bracketed-paste payloads remain literal.
755
+ let win32InputMode = prevState.win32InputMode ?? false;
756
+ let win32InputStartedAt = prevState.win32InputStartedAt;
757
+ let win32EscFlushedAt = prevState.win32EscFlushedAt;
758
+ let inPaste = prevState.mode === 'IN_PASTE';
759
+ const now = Date.now();
760
+ // Gate × evidence. The nullish default keeps direct callers that never
761
+ // inject the flag on the pre-gate behavior.
762
+ const win32HoldAllowed = (prevState.win32Capable ?? true) && win32InputMode;
763
+ const isRecordPrefix = (value) => !inPaste && WIN32_INPUT_PREFIX_RE.test(value) &&
764
+ (WIN32_INPUT_BODY_PREFIX_RE.test(value) || win32HoldAllowed);
765
+ if (win32InputStartedAt !== undefined && now - win32InputStartedAt >= WIN32_INPUT_GRACE_MS) {
766
+ tokenizer.reset();
767
+ win32InputStartedAt = undefined;
768
+ }
769
+ if (win32EscFlushedAt !== undefined && now - win32EscFlushedAt >= WIN32_INPUT_GRACE_MS) {
770
+ win32EscFlushedAt = undefined;
771
+ }
772
+ if (inputString && win32EscFlushedAt !== undefined) {
773
+ // Only the immediate continuation of an actual ESC flush may acquire
774
+ // a missing introducer. Never capture arbitrary '['-led user text.
775
+ if (prevState.mode !== 'IN_PASTE' && tokenizer.buffer() === '' &&
776
+ /^\[(?:[\d;]|$)/.test(inputString) &&
777
+ (WIN32_INPUT_BODY_PREFIX_RE.test('\x1b' + inputString) || win32HoldAllowed))
778
+ inputString = '\x1b' + inputString;
779
+ win32EscFlushedAt = undefined;
780
+ }
781
+ const pending = tokenizer.buffer();
782
+ if (isRecordPrefix(pending) && inputString) {
783
+ const continuation = /^[\d;]*/.exec(inputString)[0];
784
+ const final = inputString[continuation.length];
785
+ const code = final?.charCodeAt(0);
786
+ // A numeric prefix is not proof of Win32 framing: even four or more
787
+ // parameters can belong to another CSI. Let the tokenizer consume valid
788
+ // parameter/intermediate/final bytes; only an invalid continuation can
789
+ // abandon the old frame. A bare ASCII letter may therefore end the CSI,
790
+ // not start user text. Native Win32 typing supplies a fresh ESC record.
791
+ if (code !== undefined &&
792
+ !isCSIParam(code) && !isCSIIntermediate(code) && !isCSIFinal(code)) {
793
+ tokenizer.reset();
794
+ win32InputStartedAt = undefined;
795
+ if (final === '\x1b')
796
+ inputString = inputString.slice(continuation.length);
797
+ }
798
+ }
799
+ let deferFlush = isFlush && isRecordPrefix(tokenizer.buffer());
800
+ if (deferFlush && tokenizer.buffer().length > WIN32_INPUT_MAX_LENGTH) {
801
+ tokenizer.reset();
802
+ deferFlush = false;
803
+ }
804
+ const tokens = isFlush
805
+ ? deferFlush ? [] : tokenizer.flush()
806
+ : tokenizer.feed(inputString);
807
+ if (isFlush && !inPaste && tokens.some(token => token.value === '\x1b')) {
808
+ win32EscFlushedAt = now;
809
+ }
699
810
  // Convert tokens to parsed keys, handling paste mode
700
811
  const keys = [];
701
- let inPaste = prevState.mode === 'IN_PASTE';
702
812
  let pasteBuffer = prevState.pasteBuffer;
703
813
  // Surrogate-pair scratch for win32-input-mode records. Threaded through a
704
- // local object so prevState is never mutated — App.tsx seeds the parser
814
+ // local object so prevState is never mutated — callers can seed the parser
705
815
  // with the shared INITIAL_STATE singleton, and a pending high surrogate
706
816
  // leaking into it would survive into fresh parser instances.
707
817
  const win32Ctx = {
@@ -716,6 +826,7 @@ export function parseMultipleKeypresses(prevState, input = '') {
716
826
  matched: 0,
717
827
  held: [],
718
828
  buffer: '',
829
+ lastWasCarriageReturn: false,
719
830
  };
720
831
  const win32Protocol = prevState.win32Protocol ?? {
721
832
  held: [],
@@ -779,6 +890,7 @@ export function parseMultipleKeypresses(prevState, input = '') {
779
890
  else {
780
891
  const win32 = parseWin32KeyEvent(token.value, win32Ctx);
781
892
  if (win32 !== undefined) {
893
+ win32InputMode = true;
782
894
  // A fresh protocol record proves a held SGR prefix's report died:
783
895
  // report bytes are contiguous on the wire, so nothing may
784
896
  // interleave between a report's fragments.
@@ -857,6 +969,8 @@ export function parseMultipleKeypresses(prevState, input = '') {
857
969
  // record tails so their protocol bytes do not leak into the prompt.
858
970
  for (const tail of token.value.match(WIN32_INPUT_TAIL_RE) ?? []) {
859
971
  const win32 = parseWin32KeyEvent('\x1b' + tail, win32Ctx);
972
+ if (win32 !== undefined)
973
+ win32InputMode = true;
860
974
  if (win32 !== undefined && win32 !== null) {
861
975
  for (let i = 0; i < win32.repeat; i++) {
862
976
  keys.push(...feedWin32Input(win32Paste, win32Protocol, win32.key));
@@ -942,6 +1056,23 @@ export function parseMultipleKeypresses(prevState, input = '') {
942
1056
  }
943
1057
  }
944
1058
  }
1059
+ // Inspect the trailing buffer AFTER processing tokens: this read may have
1060
+ // entered a literal paste, or decoded the first win32 record. Emitting a
1061
+ // token ended the old sequence, so a new prefix gets its own deadline.
1062
+ if (tokens.length > 0)
1063
+ win32InputStartedAt = undefined;
1064
+ if (isRecordPrefix(tokenizer.buffer())) {
1065
+ if (tokenizer.buffer().length > WIN32_INPUT_MAX_LENGTH) {
1066
+ tokenizer.reset();
1067
+ win32InputStartedAt = undefined;
1068
+ }
1069
+ else {
1070
+ win32InputStartedAt ??= now;
1071
+ }
1072
+ }
1073
+ else {
1074
+ win32InputStartedAt = undefined;
1075
+ }
945
1076
  // If flushing and still in paste mode, emit what we have
946
1077
  if (isFlush && inPaste && pasteBuffer) {
947
1078
  keys.push(createPasteKey(pasteBuffer));
@@ -949,11 +1080,12 @@ export function parseMultipleKeypresses(prevState, input = '') {
949
1080
  pasteBuffer = '';
950
1081
  }
951
1082
  // Flush handling for the decomposed win32 paste: mid-paste (active) the
952
- // 50ms quiet timer means the paste stream ended — finalize with whatever
1083
+ // quiet timeout means the paste stream ended — finalize with whatever
953
1084
  // was collected (mirrors the VT IN_PASTE flush above; a truncated end
954
1085
  // marker must not strand the matcher and eat all future typing). Outside
955
1086
  // a paste, release any held marker-prefix keys (e.g. a lone Escape).
956
- if (isFlush && win32Paste.active) {
1087
+ // A deferred record flush must not split these higher-level matchers.
1088
+ if (isFlush && !deferFlush && win32Paste.active) {
957
1089
  let content = win32Paste.buffer;
958
1090
  for (const k of win32Paste.held)
959
1091
  content += win32RecordChar(k) ?? '';
@@ -962,16 +1094,18 @@ export function parseMultipleKeypresses(prevState, input = '') {
962
1094
  win32Paste.buffer = '';
963
1095
  win32Paste.held = [];
964
1096
  win32Paste.matched = 0;
1097
+ win32Paste.lastWasCarriageReturn = false;
965
1098
  }
966
- else if (isFlush && win32Paste.held.length > 0) {
1099
+ else if (isFlush && !deferFlush && win32Paste.held.length > 0) {
967
1100
  keys.push(...win32Paste.held);
968
1101
  win32Paste.held = [];
969
1102
  win32Paste.matched = 0;
1103
+ win32Paste.lastWasCarriageReturn = false;
970
1104
  }
971
1105
  // A quiet timeout ends a synthesized protocol candidate. Incomplete mouse
972
1106
  // reports are terminal input and must not become prompt text; other held
973
1107
  // input (a lone Escape or an unknown CSI sequence) remains ordinary keys.
974
- if (isFlush && win32Protocol.held.length > 0) {
1108
+ if (isFlush && !deferFlush && win32Protocol.held.length > 0) {
975
1109
  const isMouseCandidate = win32Protocol.sequence.startsWith('\x1b[<') ||
976
1110
  win32Protocol.sequence.startsWith('\x1b[M');
977
1111
  if (!isMouseCandidate)
@@ -1003,6 +1137,12 @@ export function parseMultipleKeypresses(prevState, input = '') {
1003
1137
  ? '\x1b'
1004
1138
  : ''),
1005
1139
  pasteBuffer,
1140
+ // The host gate rides along: App replaces its state with this object on
1141
+ // every read, and the hold must stay closed for the whole session.
1142
+ win32Capable: prevState.win32Capable,
1143
+ win32InputMode,
1144
+ win32InputStartedAt,
1145
+ win32EscFlushedAt,
1006
1146
  win32HighSurrogate: win32Ctx.high,
1007
1147
  win32AltHighSurrogate: win32Ctx.altHigh,
1008
1148
  win32Paste,
@@ -1508,6 +1648,9 @@ function parseKeypress(s = '') {
1508
1648
  case '\u001b[1;5C':
1509
1649
  return createNavKey(s, 'right', true);
1510
1650
  }
1651
+ if (!key.name && !key.code && COMPLETE_CSI_RE.test(s)) {
1652
+ key.code = s.slice(1);
1653
+ }
1511
1654
  return key;
1512
1655
  }
1513
1656
  function createNavKey(s, name, ctrl) {
@@ -1 +1 @@
1
- {"version":3,"file":"render-node-to-output.d.ts","sourceRoot":"","sources":["../../../src/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MAAM,CAAA;CACf,CAAA;AAGD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,aAAa,GAAG,WAAW,CAO7B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAIzD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAIpD;AAoFD;;;;;GAKG;AACH,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CASlE;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,wBAAwB,CAC/B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,aAAa,EAAE,EACzB,aAAa,EAAE,MAAM,EAAE,EACvB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,OAAe,GAC3B,MAAM,CA0GR;AA+DD;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAM9B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,wBAAwB,CAAC,EAAE,KAAK,CAAA;CACjC,GACA,IAAI,CAgsCN;AA2OD,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,CAAA;AAE1D,eAAe,kBAAkB,CAAA"}
@@ -796,8 +796,12 @@ function renderNodeToOutput(node, output, options) {
796
796
  // repaints.
797
797
  const imageWidth = Math.floor(width);
798
798
  const imageHeight = Math.floor(height);
799
+ // Sixel paints the raster OVER the cells only when the placement has a
800
+ // backing colour to composite onto. A transparent placement (no
801
+ // background) keeps the Kitty rule instead: blank cells, so a wallpaper
802
+ // or translucent terminal shows through around the ink.
799
803
  const backingColor = output.opaqueImageBacking
800
- ? node.style.backgroundColor ?? inheritedBackgroundColor
804
+ ? output.imagePlacementBackground(node)
801
805
  : undefined;
802
806
  const imageLine = ' '.repeat(imageWidth);
803
807
  const fillLine = backingColor === undefined
@@ -832,6 +836,9 @@ function renderNodeToOutput(node, output, options) {
832
836
  height: Math.floor(height),
833
837
  });
834
838
  }
839
+ if (node.style.softWrapContinuation !== undefined) {
840
+ output.softWrapRow(Math.floor(y), Math.floor(x) + node.style.softWrapContinuation);
841
+ }
835
842
  const overflowX = node.style.overflowX ?? node.style.overflow;
836
843
  const overflowY = node.style.overflowY ?? node.style.overflow;
837
844
  const clipHorizontally = overflowX === 'hidden' || overflowX === 'scroll';
@@ -247,6 +247,16 @@ export type Screen = Size & {
247
247
  * copies it alongside cells so the blit optimization preserves marks.
248
248
  */
249
249
  noSelect: Uint8Array;
250
+ /**
251
+ * Per-cell copy region id (0 = none) and the text each id copies as.
252
+ * A region stands for content that is not text in its cells — a formula
253
+ * drawn as a terminal image — so a selection touching it copies the
254
+ * region's text once instead of its (blank) cells. Reset, blitted and
255
+ * shifted exactly like noSelect. Optional: hand-built test screens omit
256
+ * it.
257
+ */
258
+ copyRegion?: Int32Array;
259
+ copyTexts?: Map<number, string>;
250
260
  /**
251
261
  * Per-ROW soft-wrap continuation marker. softWrap[r]=N>0 means row r
252
262
  * is a word-wrap continuation of row r-1 (the `\n` before it was
@@ -513,6 +523,20 @@ type DiffCallback = (x: number, y: number, removed: Cell | undefined, added: Cel
513
523
  * @returns true when the callback requested an early exit.
514
524
  */
515
525
  export declare function diffEach(prev: Screen, next: Screen, cb: DiffCallback): boolean;
526
+ /**
527
+ * A fresh copy region id. Ids are unique for the process, so regions blitted
528
+ * from an earlier frame never collide with new ones.
529
+ */
530
+ export declare function allocateCopyRegionId(): number;
531
+ /**
532
+ * Mark a rectangular region that copies as `text` (see Screen.copyRegion).
533
+ * Clamps to screen bounds; like noSelect it affects selection only.
534
+ */
535
+ export declare function markCopyRegion(screen: Screen, x: number, y: number, width: number, height: number, text: string, id: number): void;
536
+ /** Cells [from, to) of `row` no longer belong to any copy region. */
537
+ export declare function clearCopyRegionSpan(screen: Screen, row: number, from: number, to: number): void;
538
+ /** Drop region texts no cell references any more. */
539
+ export declare function pruneCopyTexts(screen: Screen): void;
516
540
  /**
517
541
  * Mark a rectangular region as noSelect (exclude from text selection).
518
542
  * Clamps to screen bounds. Called from output.ts when a <NoSelect> box
@@ -1 +1 @@
1
- {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../../src/ink/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,IAAI,EAEV,MAAM,sBAAsB,CAAA;AAM7B;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,SAAS,CAGf;IACF,OAAO,CAAC,KAAK,CAA8B;IAE3C;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAqB5B;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAG3B;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAA4B;IAE7C;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAW7C;;;;OAIG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGpC;AA4BD,yCAAyC;AACzC,MAAM,MAAM,GAAG,GAAG;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAA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IAAI,CAI/F;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAWnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CASN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CAyBN"}
@@ -575,6 +575,8 @@ export function createScreen(width, height, styles, charPool, hyperlinkPool) {
575
575
  emptyStyleId: styles.none,
576
576
  damage: undefined,
577
577
  noSelect: new Uint8Array(size),
578
+ copyRegion: new Int32Array(size),
579
+ copyTexts: new Map(),
578
580
  softWrap: new Int32Array(height),
579
581
  };
580
582
  }
@@ -606,6 +608,7 @@ export function resetScreen(screen, width, height) {
606
608
  screen.cells = new Int32Array(buf);
607
609
  screen.cells64 = new BigInt64Array(buf);
608
610
  screen.noSelect = new Uint8Array(size);
611
+ screen.copyRegion = new Int32Array(size);
609
612
  }
610
613
  if (screen.softWrap.length < height) {
611
614
  screen.softWrap = new Int32Array(height);
@@ -613,6 +616,12 @@ export function resetScreen(screen, width, height) {
613
616
  // Reset all cells — single fill call, no loop
614
617
  screen.cells64.fill(EMPTY_CELL_VALUE, 0, size);
615
618
  screen.noSelect.fill(0, 0, size);
619
+ if (screen.copyRegion === undefined || screen.copyRegion.length < size)
620
+ screen.copyRegion = new Int32Array(size);
621
+ else
622
+ screen.copyRegion.fill(0, 0, size);
623
+ screen.copyTexts ??= new Map();
624
+ screen.copyTexts.clear();
616
625
  screen.softWrap.fill(0, 0, height);
617
626
  // Update dimensions
618
627
  screen.width = width;
@@ -1046,6 +1055,17 @@ export function blitRegion(dst, src, regionX, regionY, maxX, maxY) {
1046
1055
  const dstCells = dst.cells;
1047
1056
  const srcNoSel = src.noSelect;
1048
1057
  const dstNoSel = dst.noSelect;
1058
+ // Copy regions travel with their cells — zeros included, so a blitted
1059
+ // overlay clears the region of a formula painted beneath it earlier in
1060
+ // this frame — and their texts come along.
1061
+ const copyRegions = dst.copyRegion === undefined
1062
+ ? undefined
1063
+ : { src: src.copyRegion, dst: dst.copyRegion };
1064
+ if (src.copyTexts !== undefined && src.copyTexts.size > 0) {
1065
+ dst.copyTexts ??= new Map();
1066
+ for (const [id, text] of src.copyTexts)
1067
+ dst.copyTexts.set(id, text);
1068
+ }
1049
1069
  // softWrap is per-row — copy the row range regardless of stride/width.
1050
1070
  // Partial-width blits still carry the row's wrap provenance since the
1051
1071
  // blitted content (a cached ink-text node) is what set the bit.
@@ -1059,6 +1079,12 @@ export function blitRegion(dst, src, regionX, regionY, maxX, maxY) {
1059
1079
  const nsStart = regionY * src.width;
1060
1080
  const nsLen = (maxY - regionY) * src.width;
1061
1081
  dstNoSel.set(srcNoSel.subarray(nsStart, nsStart + nsLen), nsStart);
1082
+ if (copyRegions) {
1083
+ if (copyRegions.src)
1084
+ copyRegions.dst.set(copyRegions.src.subarray(nsStart, nsStart + nsLen), nsStart);
1085
+ else
1086
+ copyRegions.dst.fill(0, nsStart, nsStart + nsLen);
1087
+ }
1062
1088
  }
1063
1089
  else {
1064
1090
  // Per-row copy for partial-width or mismatched-stride regions
@@ -1069,6 +1095,12 @@ export function blitRegion(dst, src, regionX, regionY, maxX, maxY) {
1069
1095
  for (let y = regionY; y < maxY; y++) {
1070
1096
  dstCells.set(srcCells.subarray(srcRowCI, srcRowCI + rowBytes), dstRowCI);
1071
1097
  dstNoSel.set(srcNoSel.subarray(srcRowNS, srcRowNS + rowLen), dstRowNS);
1098
+ if (copyRegions) {
1099
+ if (copyRegions.src)
1100
+ copyRegions.dst.set(copyRegions.src.subarray(srcRowNS, srcRowNS + rowLen), dstRowNS);
1101
+ else
1102
+ copyRegions.dst.fill(0, dstRowNS, dstRowNS + rowLen);
1103
+ }
1072
1104
  srcRowCI += srcStride;
1073
1105
  dstRowCI += dstStride;
1074
1106
  srcRowNS += src.width;
@@ -1216,11 +1248,13 @@ export function shiftRows(screen, top, bottom, n) {
1216
1248
  const w = screen.width;
1217
1249
  const cells64 = screen.cells64;
1218
1250
  const noSel = screen.noSelect;
1251
+ const copy = screen.copyRegion;
1219
1252
  const sw = screen.softWrap;
1220
1253
  const absN = Math.abs(n);
1221
1254
  if (absN > bottom - top) {
1222
1255
  cells64.fill(EMPTY_CELL_VALUE, top * w, (bottom + 1) * w);
1223
1256
  noSel.fill(0, top * w, (bottom + 1) * w);
1257
+ copy?.fill(0, top * w, (bottom + 1) * w);
1224
1258
  sw.fill(0, top, bottom + 1);
1225
1259
  return;
1226
1260
  }
@@ -1228,18 +1262,22 @@ export function shiftRows(screen, top, bottom, n) {
1228
1262
  // SU: row top+n..bottom → top..bottom-n; clear bottom-n+1..bottom
1229
1263
  cells64.copyWithin(top * w, (top + n) * w, (bottom + 1) * w);
1230
1264
  noSel.copyWithin(top * w, (top + n) * w, (bottom + 1) * w);
1265
+ copy?.copyWithin(top * w, (top + n) * w, (bottom + 1) * w);
1231
1266
  sw.copyWithin(top, top + n, bottom + 1);
1232
1267
  cells64.fill(EMPTY_CELL_VALUE, (bottom - n + 1) * w, (bottom + 1) * w);
1233
1268
  noSel.fill(0, (bottom - n + 1) * w, (bottom + 1) * w);
1269
+ copy?.fill(0, (bottom - n + 1) * w, (bottom + 1) * w);
1234
1270
  sw.fill(0, bottom - n + 1, bottom + 1);
1235
1271
  }
1236
1272
  else {
1237
1273
  // SD: row top..bottom+n → top-n..bottom; clear top..top-n-1
1238
1274
  cells64.copyWithin((top - n) * w, top * w, (bottom + n + 1) * w);
1239
1275
  noSel.copyWithin((top - n) * w, top * w, (bottom + n + 1) * w);
1276
+ copy?.copyWithin((top - n) * w, top * w, (bottom + n + 1) * w);
1240
1277
  sw.copyWithin(top - n, top, bottom + n + 1);
1241
1278
  cells64.fill(EMPTY_CELL_VALUE, top * w, (top - n) * w);
1242
1279
  noSel.fill(0, top * w, (top - n) * w);
1280
+ copy?.fill(0, top * w, (top - n) * w);
1243
1281
  sw.fill(0, top, top - n);
1244
1282
  }
1245
1283
  }
@@ -1539,6 +1577,57 @@ function diffDifferentWidth(prev, next, startX, endX, startY, endY, cb) {
1539
1577
  }
1540
1578
  return false;
1541
1579
  }
1580
+ let nextCopyRegionId = 1;
1581
+ /**
1582
+ * A fresh copy region id. Ids are unique for the process, so regions blitted
1583
+ * from an earlier frame never collide with new ones.
1584
+ */
1585
+ export function allocateCopyRegionId() {
1586
+ const id = nextCopyRegionId;
1587
+ nextCopyRegionId = nextCopyRegionId >= 0x7fffffff ? 1 : nextCopyRegionId + 1;
1588
+ return id;
1589
+ }
1590
+ /**
1591
+ * Mark a rectangular region that copies as `text` (see Screen.copyRegion).
1592
+ * Clamps to screen bounds; like noSelect it affects selection only.
1593
+ */
1594
+ export function markCopyRegion(screen, x, y, width, height, text, id) {
1595
+ if (screen.copyRegion === undefined)
1596
+ return;
1597
+ const maxX = Math.min(x + width, screen.width);
1598
+ const maxY = Math.min(y + height, screen.height);
1599
+ const stride = screen.width;
1600
+ for (let row = Math.max(0, y); row < maxY; row++) {
1601
+ const rowStart = row * stride;
1602
+ screen.copyRegion.fill(id, rowStart + Math.max(0, x), rowStart + maxX);
1603
+ }
1604
+ ;
1605
+ (screen.copyTexts ??= new Map()).set(id, text);
1606
+ }
1607
+ /** Cells [from, to) of `row` no longer belong to any copy region. */
1608
+ export function clearCopyRegionSpan(screen, row, from, to) {
1609
+ if (screen.copyRegion === undefined || row < 0 || row >= screen.height)
1610
+ return;
1611
+ const rowStart = row * screen.width;
1612
+ screen.copyRegion.fill(0, rowStart + Math.max(0, from), rowStart + Math.min(to, screen.width));
1613
+ }
1614
+ /** Drop region texts no cell references any more. */
1615
+ export function pruneCopyTexts(screen) {
1616
+ const texts = screen.copyTexts;
1617
+ if (texts === undefined || texts.size === 0 || screen.copyRegion === undefined)
1618
+ return;
1619
+ const live = new Set();
1620
+ const cells = screen.copyRegion;
1621
+ const size = screen.width * screen.height;
1622
+ for (let index = 0; index < size; index++) {
1623
+ const id = cells[index];
1624
+ if (id !== 0)
1625
+ live.add(id);
1626
+ }
1627
+ for (const id of texts.keys())
1628
+ if (!live.has(id))
1629
+ texts.delete(id);
1630
+ }
1542
1631
  /**
1543
1632
  * Mark a rectangular region as noSelect (exclude from text selection).
1544
1633
  * Clamps to screen bounds. Called from output.ts when a <NoSelect> box