@quantum-ai/gemini-cli 0.45.4 → 0.45.5

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 (1440) hide show
  1. package/README.md +394 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/package.json +12 -11
  5. package/dist/src/config/settingsSchema.d.ts +1 -1
  6. package/dist/src/index.d.ts +1 -0
  7. package/dist/src/index.js +1 -0
  8. package/dist/src/index.js.map +1 -1
  9. package/dist/src/ui/App.d.ts +1 -1
  10. package/dist/src/ui/AppContainer.d.ts +1 -1
  11. package/dist/src/ui/IdeIntegrationNudge.d.ts +1 -1
  12. package/dist/src/ui/auth/LoginRestartDialog.d.ts +1 -1
  13. package/dist/src/ui/components/AdminSettingsChangedDialog.d.ts +1 -1
  14. package/dist/src/ui/components/AlternateBufferQuittingDisplay.d.ts +1 -1
  15. package/dist/src/ui/components/AppHeader.d.ts +1 -1
  16. package/dist/src/ui/components/BackgroundTaskDisplay.d.ts +1 -1
  17. package/dist/src/ui/components/Banner.d.ts +1 -1
  18. package/dist/src/ui/components/CliSpinner.d.ts +1 -1
  19. package/dist/src/ui/components/Composer.d.ts +1 -1
  20. package/dist/src/ui/components/ConfigInitDisplay.d.ts +1 -1
  21. package/dist/src/ui/components/ConsentPrompt.d.ts +1 -1
  22. package/dist/src/ui/components/ContextUsageDisplay.d.ts +1 -1
  23. package/dist/src/ui/components/DebugProfiler.d.ts +1 -1
  24. package/dist/src/ui/components/DialogManager.d.ts +1 -1
  25. package/dist/src/ui/components/IdeTrustChangeDialog.d.ts +1 -1
  26. package/dist/src/ui/components/LoopDetectionConfirmation.d.ts +1 -1
  27. package/dist/src/ui/components/MainContent.d.ts +1 -1
  28. package/dist/src/ui/components/ModelQuotaDisplay.d.ts +1 -1
  29. package/dist/src/ui/components/NewAgentsNotification.d.ts +1 -1
  30. package/dist/src/ui/components/Notifications.d.ts +1 -1
  31. package/dist/src/ui/components/QueuedMessageDisplay.d.ts +1 -1
  32. package/dist/src/ui/components/QuittingDisplay.d.ts +1 -1
  33. package/dist/src/ui/components/ShowMoreLines.d.ts +1 -1
  34. package/dist/src/ui/components/SuggestionsDisplay.d.ts +1 -1
  35. package/dist/src/ui/components/Table.d.ts +1 -1
  36. package/dist/src/ui/components/UpdateNotification.d.ts +1 -1
  37. package/dist/src/ui/components/shared/SlicingMaxSizedBox.d.ts +1 -1
  38. package/dist/src/ui/components/triage/TriageDuplicates.d.ts +1 -1
  39. package/dist/src/ui/components/triage/TriageIssues.d.ts +1 -1
  40. package/dist/src/ui/contexts/KeypressContext.d.ts +1 -1
  41. package/dist/src/ui/contexts/MouseContext.d.ts +1 -1
  42. package/dist/src/ui/contexts/TerminalContext.d.ts +1 -1
  43. package/dist/src/ui/contexts/VimModeContext.d.ts +1 -1
  44. package/dist/src/ui/hooks/useExtensionUpdates.d.ts +2 -2
  45. package/dist/src/ui/hooks/useInlineEditBuffer.d.ts +1 -1
  46. package/dist/src/ui/hooks/useStateAndRef.d.ts +1 -1
  47. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +1 -1
  48. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.d.ts +1 -1
  49. package/dist/src/ui/privacy/GeminiPrivacyNotice.d.ts +1 -1
  50. package/dist/src/ui/privacy/PrivacyNotice.d.ts +1 -1
  51. package/dist/src/utils/devtoolsService.js +1 -1
  52. package/dist/src/utils/devtoolsService.js.map +1 -1
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +12 -11
  55. package/dist/src/acp/acpCommandHandler.test.d.ts +0 -6
  56. package/dist/src/acp/acpCommandHandler.test.js +0 -28
  57. package/dist/src/acp/acpCommandHandler.test.js.map +0 -1
  58. package/dist/src/acp/acpErrors.test.d.ts +0 -6
  59. package/dist/src/acp/acpErrors.test.js +0 -38
  60. package/dist/src/acp/acpErrors.test.js.map +0 -1
  61. package/dist/src/acp/acpFileSystemService.test.d.ts +0 -6
  62. package/dist/src/acp/acpFileSystemService.test.js +0 -162
  63. package/dist/src/acp/acpFileSystemService.test.js.map +0 -1
  64. package/dist/src/acp/acpResume.test.d.ts +0 -6
  65. package/dist/src/acp/acpResume.test.js +0 -260
  66. package/dist/src/acp/acpResume.test.js.map +0 -1
  67. package/dist/src/acp/acpRpcDispatcher.test.d.ts +0 -6
  68. package/dist/src/acp/acpRpcDispatcher.test.js +0 -238
  69. package/dist/src/acp/acpRpcDispatcher.test.js.map +0 -1
  70. package/dist/src/acp/acpSession.test.d.ts +0 -6
  71. package/dist/src/acp/acpSession.test.js +0 -742
  72. package/dist/src/acp/acpSession.test.js.map +0 -1
  73. package/dist/src/acp/acpSessionManager.test.d.ts +0 -6
  74. package/dist/src/acp/acpSessionManager.test.js +0 -283
  75. package/dist/src/acp/acpSessionManager.test.js.map +0 -1
  76. package/dist/src/acp/commands/extensions.test.d.ts +0 -6
  77. package/dist/src/acp/commands/extensions.test.js +0 -70
  78. package/dist/src/acp/commands/extensions.test.js.map +0 -1
  79. package/dist/src/acp/commands/help.test.d.ts +0 -6
  80. package/dist/src/acp/commands/help.test.js +0 -40
  81. package/dist/src/acp/commands/help.test.js.map +0 -1
  82. package/dist/src/acp/commands/restore.test.d.ts +0 -6
  83. package/dist/src/acp/commands/restore.test.js +0 -173
  84. package/dist/src/acp/commands/restore.test.js.map +0 -1
  85. package/dist/src/commands/extensions/configure.test.d.ts +0 -1
  86. package/dist/src/commands/extensions/configure.test.js +0 -195
  87. package/dist/src/commands/extensions/configure.test.js.map +0 -1
  88. package/dist/src/commands/extensions/disable.test.d.ts +0 -6
  89. package/dist/src/commands/extensions/disable.test.js +0 -169
  90. package/dist/src/commands/extensions/disable.test.js.map +0 -1
  91. package/dist/src/commands/extensions/enable.test.d.ts +0 -6
  92. package/dist/src/commands/extensions/enable.test.js +0 -199
  93. package/dist/src/commands/extensions/enable.test.js.map +0 -1
  94. package/dist/src/commands/extensions/install.test.d.ts +0 -6
  95. package/dist/src/commands/extensions/install.test.js +0 -311
  96. package/dist/src/commands/extensions/install.test.js.map +0 -1
  97. package/dist/src/commands/extensions/link.test.d.ts +0 -6
  98. package/dist/src/commands/extensions/link.test.js +0 -121
  99. package/dist/src/commands/extensions/link.test.js.map +0 -1
  100. package/dist/src/commands/extensions/list.test.d.ts +0 -6
  101. package/dist/src/commands/extensions/list.test.js +0 -132
  102. package/dist/src/commands/extensions/list.test.js.map +0 -1
  103. package/dist/src/commands/extensions/new.test.d.ts +0 -6
  104. package/dist/src/commands/extensions/new.test.js +0 -62
  105. package/dist/src/commands/extensions/new.test.js.map +0 -1
  106. package/dist/src/commands/extensions/uninstall.test.d.ts +0 -6
  107. package/dist/src/commands/extensions/uninstall.test.js +0 -240
  108. package/dist/src/commands/extensions/uninstall.test.js.map +0 -1
  109. package/dist/src/commands/extensions/update.test.d.ts +0 -6
  110. package/dist/src/commands/extensions/update.test.js +0 -196
  111. package/dist/src/commands/extensions/update.test.js.map +0 -1
  112. package/dist/src/commands/extensions/validate.test.d.ts +0 -6
  113. package/dist/src/commands/extensions/validate.test.js +0 -96
  114. package/dist/src/commands/extensions/validate.test.js.map +0 -1
  115. package/dist/src/commands/extensions.test.d.ts +0 -6
  116. package/dist/src/commands/extensions.test.js +0 -67
  117. package/dist/src/commands/extensions.test.js.map +0 -1
  118. package/dist/src/commands/gemma/logs.test.d.ts +0 -6
  119. package/dist/src/commands/gemma/logs.test.js +0 -122
  120. package/dist/src/commands/gemma/logs.test.js.map +0 -1
  121. package/dist/src/commands/gemma/platform.test.d.ts +0 -6
  122. package/dist/src/commands/gemma/platform.test.js +0 -108
  123. package/dist/src/commands/gemma/platform.test.js.map +0 -1
  124. package/dist/src/commands/gemma/setup.test.d.ts +0 -6
  125. package/dist/src/commands/gemma/setup.test.js +0 -36
  126. package/dist/src/commands/gemma/setup.test.js.map +0 -1
  127. package/dist/src/commands/gemma/stop.test.d.ts +0 -6
  128. package/dist/src/commands/gemma/stop.test.js +0 -89
  129. package/dist/src/commands/gemma/stop.test.js.map +0 -1
  130. package/dist/src/commands/hooks/migrate.test.d.ts +0 -6
  131. package/dist/src/commands/hooks/migrate.test.js +0 -388
  132. package/dist/src/commands/hooks/migrate.test.js.map +0 -1
  133. package/dist/src/commands/mcp/add.test.d.ts +0 -6
  134. package/dist/src/commands/mcp/add.test.js +0 -274
  135. package/dist/src/commands/mcp/add.test.js.map +0 -1
  136. package/dist/src/commands/mcp/list.test.d.ts +0 -6
  137. package/dist/src/commands/mcp/list.test.js +0 -477
  138. package/dist/src/commands/mcp/list.test.js.map +0 -1
  139. package/dist/src/commands/mcp/remove.test.d.ts +0 -6
  140. package/dist/src/commands/mcp/remove.test.js +0 -206
  141. package/dist/src/commands/mcp/remove.test.js.map +0 -1
  142. package/dist/src/commands/mcp.test.d.ts +0 -6
  143. package/dist/src/commands/mcp.test.js +0 -64
  144. package/dist/src/commands/mcp.test.js.map +0 -1
  145. package/dist/src/commands/skills/disable.test.d.ts +0 -6
  146. package/dist/src/commands/skills/disable.test.js +0 -93
  147. package/dist/src/commands/skills/disable.test.js.map +0 -1
  148. package/dist/src/commands/skills/enable.test.d.ts +0 -6
  149. package/dist/src/commands/skills/enable.test.js +0 -104
  150. package/dist/src/commands/skills/enable.test.js.map +0 -1
  151. package/dist/src/commands/skills/install.test.d.ts +0 -6
  152. package/dist/src/commands/skills/install.test.js +0 -99
  153. package/dist/src/commands/skills/install.test.js.map +0 -1
  154. package/dist/src/commands/skills/link.test.d.ts +0 -6
  155. package/dist/src/commands/skills/link.test.js +0 -53
  156. package/dist/src/commands/skills/link.test.js.map +0 -1
  157. package/dist/src/commands/skills/list.test.d.ts +0 -6
  158. package/dist/src/commands/skills/list.test.js +0 -127
  159. package/dist/src/commands/skills/list.test.js.map +0 -1
  160. package/dist/src/commands/skills/uninstall.test.d.ts +0 -6
  161. package/dist/src/commands/skills/uninstall.test.js +0 -65
  162. package/dist/src/commands/skills/uninstall.test.js.map +0 -1
  163. package/dist/src/commands/skills.test.d.ts +0 -6
  164. package/dist/src/commands/skills.test.js +0 -49
  165. package/dist/src/commands/skills.test.js.map +0 -1
  166. package/dist/src/commands/utils.test.d.ts +0 -6
  167. package/dist/src/commands/utils.test.js +0 -35
  168. package/dist/src/commands/utils.test.js.map +0 -1
  169. package/dist/src/config/auth.test.d.ts +0 -6
  170. package/dist/src/config/auth.test.js +0 -96
  171. package/dist/src/config/auth.test.js.map +0 -1
  172. package/dist/src/config/config.integration.test.d.ts +0 -6
  173. package/dist/src/config/config.integration.test.js +0 -205
  174. package/dist/src/config/config.integration.test.js.map +0 -1
  175. package/dist/src/config/config.test.d.ts +0 -6
  176. package/dist/src/config/config.test.js +0 -3124
  177. package/dist/src/config/config.test.js.map +0 -1
  178. package/dist/src/config/extension-manager-agents.test.d.ts +0 -6
  179. package/dist/src/config/extension-manager-agents.test.js +0 -116
  180. package/dist/src/config/extension-manager-agents.test.js.map +0 -1
  181. package/dist/src/config/extension-manager-hydration.test.d.ts +0 -6
  182. package/dist/src/config/extension-manager-hydration.test.js +0 -262
  183. package/dist/src/config/extension-manager-hydration.test.js.map +0 -1
  184. package/dist/src/config/extension-manager-permissions.test.d.ts +0 -6
  185. package/dist/src/config/extension-manager-permissions.test.js +0 -107
  186. package/dist/src/config/extension-manager-permissions.test.js.map +0 -1
  187. package/dist/src/config/extension-manager-scope.test.d.ts +0 -6
  188. package/dist/src/config/extension-manager-scope.test.js +0 -158
  189. package/dist/src/config/extension-manager-scope.test.js.map +0 -1
  190. package/dist/src/config/extension-manager-skills.test.d.ts +0 -6
  191. package/dist/src/config/extension-manager-skills.test.js +0 -157
  192. package/dist/src/config/extension-manager-skills.test.js.map +0 -1
  193. package/dist/src/config/extension-manager.test.d.ts +0 -6
  194. package/dist/src/config/extension-manager.test.js +0 -430
  195. package/dist/src/config/extension-manager.test.js.map +0 -1
  196. package/dist/src/config/extension.test.d.ts +0 -6
  197. package/dist/src/config/extension.test.js +0 -1800
  198. package/dist/src/config/extension.test.js.map +0 -1
  199. package/dist/src/config/extensionRegistryClient.test.d.ts +0 -6
  200. package/dist/src/config/extensionRegistryClient.test.js +0 -261
  201. package/dist/src/config/extensionRegistryClient.test.js.map +0 -1
  202. package/dist/src/config/extensions/consent.test.d.ts +0 -6
  203. package/dist/src/config/extensions/consent.test.js +0 -302
  204. package/dist/src/config/extensions/consent.test.js.map +0 -1
  205. package/dist/src/config/extensions/extensionEnablement.test.d.ts +0 -6
  206. package/dist/src/config/extensions/extensionEnablement.test.js +0 -404
  207. package/dist/src/config/extensions/extensionEnablement.test.js.map +0 -1
  208. package/dist/src/config/extensions/extensionSettings.test.d.ts +0 -6
  209. package/dist/src/config/extensions/extensionSettings.test.js +0 -575
  210. package/dist/src/config/extensions/extensionSettings.test.js.map +0 -1
  211. package/dist/src/config/extensions/extensionUpdates.test.d.ts +0 -6
  212. package/dist/src/config/extensions/extensionUpdates.test.js +0 -265
  213. package/dist/src/config/extensions/extensionUpdates.test.js.map +0 -1
  214. package/dist/src/config/extensions/github.test.d.ts +0 -6
  215. package/dist/src/config/extensions/github.test.js +0 -454
  216. package/dist/src/config/extensions/github.test.js.map +0 -1
  217. package/dist/src/config/extensions/github_fetch.test.d.ts +0 -6
  218. package/dist/src/config/extensions/github_fetch.test.js +0 -171
  219. package/dist/src/config/extensions/github_fetch.test.js.map +0 -1
  220. package/dist/src/config/extensions/storage.test.d.ts +0 -6
  221. package/dist/src/config/extensions/storage.test.js +0 -64
  222. package/dist/src/config/extensions/storage.test.js.map +0 -1
  223. package/dist/src/config/extensions/update.test.d.ts +0 -6
  224. package/dist/src/config/extensions/update.test.js +0 -296
  225. package/dist/src/config/extensions/update.test.js.map +0 -1
  226. package/dist/src/config/extensions/variables.test.d.ts +0 -6
  227. package/dist/src/config/extensions/variables.test.js +0 -119
  228. package/dist/src/config/extensions/variables.test.js.map +0 -1
  229. package/dist/src/config/footerItems.test.d.ts +0 -6
  230. package/dist/src/config/footerItems.test.js +0 -180
  231. package/dist/src/config/footerItems.test.js.map +0 -1
  232. package/dist/src/config/mcp/mcpServerEnablement.test.d.ts +0 -6
  233. package/dist/src/config/mcp/mcpServerEnablement.test.js +0 -148
  234. package/dist/src/config/mcp/mcpServerEnablement.test.js.map +0 -1
  235. package/dist/src/config/mutual-exclusivity.test.d.ts +0 -6
  236. package/dist/src/config/mutual-exclusivity.test.js +0 -33
  237. package/dist/src/config/mutual-exclusivity.test.js.map +0 -1
  238. package/dist/src/config/policy-engine.integration.test.d.ts +0 -6
  239. package/dist/src/config/policy-engine.integration.test.js +0 -394
  240. package/dist/src/config/policy-engine.integration.test.js.map +0 -1
  241. package/dist/src/config/policy.test.d.ts +0 -6
  242. package/dist/src/config/policy.test.js +0 -199
  243. package/dist/src/config/policy.test.js.map +0 -1
  244. package/dist/src/config/sandboxConfig.test.d.ts +0 -6
  245. package/dist/src/config/sandboxConfig.test.js +0 -401
  246. package/dist/src/config/sandboxConfig.test.js.map +0 -1
  247. package/dist/src/config/settingPaths.test.d.ts +0 -6
  248. package/dist/src/config/settingPaths.test.js +0 -22
  249. package/dist/src/config/settingPaths.test.js.map +0 -1
  250. package/dist/src/config/settings-env-isolation.test.d.ts +0 -6
  251. package/dist/src/config/settings-env-isolation.test.js +0 -188
  252. package/dist/src/config/settings-env-isolation.test.js.map +0 -1
  253. package/dist/src/config/settings-validation.test.d.ts +0 -6
  254. package/dist/src/config/settings-validation.test.js +0 -464
  255. package/dist/src/config/settings-validation.test.js.map +0 -1
  256. package/dist/src/config/settings.test.d.ts +0 -6
  257. package/dist/src/config/settings.test.js +0 -2660
  258. package/dist/src/config/settings.test.js.map +0 -1
  259. package/dist/src/config/settingsSchema.test.d.ts +0 -6
  260. package/dist/src/config/settingsSchema.test.js +0 -450
  261. package/dist/src/config/settingsSchema.test.js.map +0 -1
  262. package/dist/src/config/settings_repro.test.d.ts +0 -6
  263. package/dist/src/config/settings_repro.test.js +0 -163
  264. package/dist/src/config/settings_repro.test.js.map +0 -1
  265. package/dist/src/config/settings_validation_warning.test.d.ts +0 -6
  266. package/dist/src/config/settings_validation_warning.test.js +0 -124
  267. package/dist/src/config/settings_validation_warning.test.js.map +0 -1
  268. package/dist/src/config/skipExtensions.test.d.ts +0 -6
  269. package/dist/src/config/skipExtensions.test.js +0 -49
  270. package/dist/src/config/skipExtensions.test.js.map +0 -1
  271. package/dist/src/config/trustedFolders.test.d.ts +0 -6
  272. package/dist/src/config/trustedFolders.test.js +0 -411
  273. package/dist/src/config/trustedFolders.test.js.map +0 -1
  274. package/dist/src/config/workspace-policy-cli.test.d.ts +0 -6
  275. package/dist/src/config/workspace-policy-cli.test.js +0 -204
  276. package/dist/src/config/workspace-policy-cli.test.js.map +0 -1
  277. package/dist/src/core/auth.test.d.ts +0 -6
  278. package/dist/src/core/auth.test.js +0 -93
  279. package/dist/src/core/auth.test.js.map +0 -1
  280. package/dist/src/core/initializer.test.d.ts +0 -6
  281. package/dist/src/core/initializer.test.js +0 -111
  282. package/dist/src/core/initializer.test.js.map +0 -1
  283. package/dist/src/core/theme.test.d.ts +0 -6
  284. package/dist/src/core/theme.test.js +0 -46
  285. package/dist/src/core/theme.test.js.map +0 -1
  286. package/dist/src/deferred.test.d.ts +0 -6
  287. package/dist/src/deferred.test.js +0 -180
  288. package/dist/src/deferred.test.js.map +0 -1
  289. package/dist/src/gemini.test.d.ts +0 -6
  290. package/dist/src/gemini.test.js +0 -1432
  291. package/dist/src/gemini.test.js.map +0 -1
  292. package/dist/src/gemini_cleanup.test.d.ts +0 -6
  293. package/dist/src/gemini_cleanup.test.js +0 -391
  294. package/dist/src/gemini_cleanup.test.js.map +0 -1
  295. package/dist/src/integration-tests/modelSteering.test.d.ts +0 -6
  296. package/dist/src/integration-tests/modelSteering.test.js +0 -62
  297. package/dist/src/integration-tests/modelSteering.test.js.map +0 -1
  298. package/dist/src/nonInteractiveCli.test.d.ts +0 -6
  299. package/dist/src/nonInteractiveCli.test.js +0 -1921
  300. package/dist/src/nonInteractiveCli.test.js.map +0 -1
  301. package/dist/src/nonInteractiveCliAgentSession.test.d.ts +0 -6
  302. package/dist/src/nonInteractiveCliAgentSession.test.js +0 -2015
  303. package/dist/src/nonInteractiveCliAgentSession.test.js.map +0 -1
  304. package/dist/src/output-redirection.test.d.ts +0 -6
  305. package/dist/src/output-redirection.test.js +0 -77
  306. package/dist/src/output-redirection.test.js.map +0 -1
  307. package/dist/src/services/BuiltinCommandLoader.test.d.ts +0 -6
  308. package/dist/src/services/BuiltinCommandLoader.test.js +0 -369
  309. package/dist/src/services/BuiltinCommandLoader.test.js.map +0 -1
  310. package/dist/src/services/CommandService.test.d.ts +0 -6
  311. package/dist/src/services/CommandService.test.js +0 -74
  312. package/dist/src/services/CommandService.test.js.map +0 -1
  313. package/dist/src/services/FileCommandLoader.test.d.ts +0 -6
  314. package/dist/src/services/FileCommandLoader.test.js +0 -1128
  315. package/dist/src/services/FileCommandLoader.test.js.map +0 -1
  316. package/dist/src/services/McpPromptLoader.test.d.ts +0 -6
  317. package/dist/src/services/McpPromptLoader.test.js +0 -411
  318. package/dist/src/services/McpPromptLoader.test.js.map +0 -1
  319. package/dist/src/services/SkillCommandLoader.test.d.ts +0 -6
  320. package/dist/src/services/SkillCommandLoader.test.js +0 -113
  321. package/dist/src/services/SkillCommandLoader.test.js.map +0 -1
  322. package/dist/src/services/SlashCommandConflictHandler.test.d.ts +0 -6
  323. package/dist/src/services/SlashCommandConflictHandler.test.js +0 -144
  324. package/dist/src/services/SlashCommandConflictHandler.test.js.map +0 -1
  325. package/dist/src/services/SlashCommandResolver.test.d.ts +0 -6
  326. package/dist/src/services/SlashCommandResolver.test.js +0 -186
  327. package/dist/src/services/SlashCommandResolver.test.js.map +0 -1
  328. package/dist/src/services/liteRtServerManager.test.d.ts +0 -6
  329. package/dist/src/services/liteRtServerManager.test.js +0 -54
  330. package/dist/src/services/liteRtServerManager.test.js.map +0 -1
  331. package/dist/src/services/prompt-processors/argumentProcessor.test.d.ts +0 -6
  332. package/dist/src/services/prompt-processors/argumentProcessor.test.js +0 -40
  333. package/dist/src/services/prompt-processors/argumentProcessor.test.js.map +0 -1
  334. package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +0 -6
  335. package/dist/src/services/prompt-processors/atFileProcessor.test.js +0 -177
  336. package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +0 -1
  337. package/dist/src/services/prompt-processors/injectionParser.test.d.ts +0 -6
  338. package/dist/src/services/prompt-processors/injectionParser.test.js +0 -189
  339. package/dist/src/services/prompt-processors/injectionParser.test.js.map +0 -1
  340. package/dist/src/services/prompt-processors/shellProcessor.test.d.ts +0 -6
  341. package/dist/src/services/prompt-processors/shellProcessor.test.js +0 -525
  342. package/dist/src/services/prompt-processors/shellProcessor.test.js.map +0 -1
  343. package/dist/src/test-utils/AppRig.test.d.ts +0 -6
  344. package/dist/src/test-utils/AppRig.test.js +0 -60
  345. package/dist/src/test-utils/AppRig.test.js.map +0 -1
  346. package/dist/src/test-utils/mockCommandContext.test.d.ts +0 -6
  347. package/dist/src/test-utils/mockCommandContext.test.js +0 -51
  348. package/dist/src/test-utils/mockCommandContext.test.js.map +0 -1
  349. package/dist/src/test-utils/render.test.d.ts +0 -6
  350. package/dist/src/test-utils/render.test.js +0 -84
  351. package/dist/src/test-utils/render.test.js.map +0 -1
  352. package/dist/src/ui/App.test.d.ts +0 -6
  353. package/dist/src/ui/App.test.js +0 -244
  354. package/dist/src/ui/App.test.js.map +0 -1
  355. package/dist/src/ui/AppContainer.test.d.ts +0 -6
  356. package/dist/src/ui/AppContainer.test.js +0 -2824
  357. package/dist/src/ui/AppContainer.test.js.map +0 -1
  358. package/dist/src/ui/IdeIntegrationNudge.test.d.ts +0 -6
  359. package/dist/src/ui/IdeIntegrationNudge.test.js +0 -149
  360. package/dist/src/ui/IdeIntegrationNudge.test.js.map +0 -1
  361. package/dist/src/ui/ToolConfirmationFullFrame.test.d.ts +0 -1
  362. package/dist/src/ui/ToolConfirmationFullFrame.test.js +0 -153
  363. package/dist/src/ui/ToolConfirmationFullFrame.test.js.map +0 -1
  364. package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +0 -6
  365. package/dist/src/ui/auth/ApiAuthDialog.test.js +0 -127
  366. package/dist/src/ui/auth/ApiAuthDialog.test.js.map +0 -1
  367. package/dist/src/ui/auth/AuthDialog.test.d.ts +0 -6
  368. package/dist/src/ui/auth/AuthDialog.test.js +0 -350
  369. package/dist/src/ui/auth/AuthDialog.test.js.map +0 -1
  370. package/dist/src/ui/auth/AuthInProgress.test.d.ts +0 -6
  371. package/dist/src/ui/auth/AuthInProgress.test.js +0 -99
  372. package/dist/src/ui/auth/AuthInProgress.test.js.map +0 -1
  373. package/dist/src/ui/auth/BannedAccountDialog.test.d.ts +0 -6
  374. package/dist/src/ui/auth/BannedAccountDialog.test.js +0 -141
  375. package/dist/src/ui/auth/BannedAccountDialog.test.js.map +0 -1
  376. package/dist/src/ui/auth/LoginRestartDialog.test.d.ts +0 -6
  377. package/dist/src/ui/auth/LoginRestartDialog.test.js +0 -79
  378. package/dist/src/ui/auth/LoginRestartDialog.test.js.map +0 -1
  379. package/dist/src/ui/auth/useAuth.test.d.ts +0 -6
  380. package/dist/src/ui/auth/useAuth.test.js +0 -214
  381. package/dist/src/ui/auth/useAuth.test.js.map +0 -1
  382. package/dist/src/ui/commands/aboutCommand.test.d.ts +0 -6
  383. package/dist/src/ui/commands/aboutCommand.test.js +0 -145
  384. package/dist/src/ui/commands/aboutCommand.test.js.map +0 -1
  385. package/dist/src/ui/commands/agentsCommand.test.d.ts +0 -6
  386. package/dist/src/ui/commands/agentsCommand.test.js +0 -382
  387. package/dist/src/ui/commands/agentsCommand.test.js.map +0 -1
  388. package/dist/src/ui/commands/authCommand.test.d.ts +0 -6
  389. package/dist/src/ui/commands/authCommand.test.js +0 -103
  390. package/dist/src/ui/commands/authCommand.test.js.map +0 -1
  391. package/dist/src/ui/commands/bugCommand.test.d.ts +0 -6
  392. package/dist/src/ui/commands/bugCommand.test.js +0 -305
  393. package/dist/src/ui/commands/bugCommand.test.js.map +0 -1
  394. package/dist/src/ui/commands/bugMemoryCommand.test.d.ts +0 -6
  395. package/dist/src/ui/commands/bugMemoryCommand.test.js +0 -100
  396. package/dist/src/ui/commands/bugMemoryCommand.test.js.map +0 -1
  397. package/dist/src/ui/commands/chatCommand.test.d.ts +0 -6
  398. package/dist/src/ui/commands/chatCommand.test.js +0 -627
  399. package/dist/src/ui/commands/chatCommand.test.js.map +0 -1
  400. package/dist/src/ui/commands/clearCommand.test.d.ts +0 -6
  401. package/dist/src/ui/commands/clearCommand.test.js +0 -98
  402. package/dist/src/ui/commands/clearCommand.test.js.map +0 -1
  403. package/dist/src/ui/commands/commandsCommand.test.d.ts +0 -6
  404. package/dist/src/ui/commands/commandsCommand.test.js +0 -115
  405. package/dist/src/ui/commands/commandsCommand.test.js.map +0 -1
  406. package/dist/src/ui/commands/compressCommand.test.d.ts +0 -6
  407. package/dist/src/ui/commands/compressCommand.test.js +0 -110
  408. package/dist/src/ui/commands/compressCommand.test.js.map +0 -1
  409. package/dist/src/ui/commands/copyCommand.test.d.ts +0 -6
  410. package/dist/src/ui/commands/copyCommand.test.js +0 -244
  411. package/dist/src/ui/commands/copyCommand.test.js.map +0 -1
  412. package/dist/src/ui/commands/corgiCommand.test.d.ts +0 -6
  413. package/dist/src/ui/commands/corgiCommand.test.js +0 -28
  414. package/dist/src/ui/commands/corgiCommand.test.js.map +0 -1
  415. package/dist/src/ui/commands/directoryCommand.test.d.ts +0 -6
  416. package/dist/src/ui/commands/directoryCommand.test.js +0 -365
  417. package/dist/src/ui/commands/directoryCommand.test.js.map +0 -1
  418. package/dist/src/ui/commands/docsCommand.test.d.ts +0 -6
  419. package/dist/src/ui/commands/docsCommand.test.js +0 -72
  420. package/dist/src/ui/commands/docsCommand.test.js.map +0 -1
  421. package/dist/src/ui/commands/editorCommand.test.d.ts +0 -6
  422. package/dist/src/ui/commands/editorCommand.test.js +0 -27
  423. package/dist/src/ui/commands/editorCommand.test.js.map +0 -1
  424. package/dist/src/ui/commands/exportSessionCommand.test.d.ts +0 -6
  425. package/dist/src/ui/commands/exportSessionCommand.test.js +0 -100
  426. package/dist/src/ui/commands/exportSessionCommand.test.js.map +0 -1
  427. package/dist/src/ui/commands/extensionsCommand.test.d.ts +0 -6
  428. package/dist/src/ui/commands/extensionsCommand.test.js +0 -947
  429. package/dist/src/ui/commands/extensionsCommand.test.js.map +0 -1
  430. package/dist/src/ui/commands/helpCommand.test.d.ts +0 -6
  431. package/dist/src/ui/commands/helpCommand.test.js +0 -94
  432. package/dist/src/ui/commands/helpCommand.test.js.map +0 -1
  433. package/dist/src/ui/commands/hooksCommand.test.d.ts +0 -6
  434. package/dist/src/ui/commands/hooksCommand.test.js +0 -562
  435. package/dist/src/ui/commands/hooksCommand.test.js.map +0 -1
  436. package/dist/src/ui/commands/ideCommand.test.d.ts +0 -6
  437. package/dist/src/ui/commands/ideCommand.test.js +0 -205
  438. package/dist/src/ui/commands/ideCommand.test.js.map +0 -1
  439. package/dist/src/ui/commands/initCommand.test.d.ts +0 -6
  440. package/dist/src/ui/commands/initCommand.test.js +0 -86
  441. package/dist/src/ui/commands/initCommand.test.js.map +0 -1
  442. package/dist/src/ui/commands/mcpCommand.test.d.ts +0 -6
  443. package/dist/src/ui/commands/mcpCommand.test.js +0 -231
  444. package/dist/src/ui/commands/mcpCommand.test.js.map +0 -1
  445. package/dist/src/ui/commands/memoryCommand.test.d.ts +0 -6
  446. package/dist/src/ui/commands/memoryCommand.test.js +0 -361
  447. package/dist/src/ui/commands/memoryCommand.test.js.map +0 -1
  448. package/dist/src/ui/commands/modelCommand.test.d.ts +0 -6
  449. package/dist/src/ui/commands/modelCommand.test.js +0 -135
  450. package/dist/src/ui/commands/modelCommand.test.js.map +0 -1
  451. package/dist/src/ui/commands/permissionsCommand.test.d.ts +0 -6
  452. package/dist/src/ui/commands/permissionsCommand.test.js +0 -86
  453. package/dist/src/ui/commands/permissionsCommand.test.js.map +0 -1
  454. package/dist/src/ui/commands/planCommand.test.d.ts +0 -6
  455. package/dist/src/ui/commands/planCommand.test.js +0 -146
  456. package/dist/src/ui/commands/planCommand.test.js.map +0 -1
  457. package/dist/src/ui/commands/policiesCommand.test.d.ts +0 -6
  458. package/dist/src/ui/commands/policiesCommand.test.js +0 -133
  459. package/dist/src/ui/commands/policiesCommand.test.js.map +0 -1
  460. package/dist/src/ui/commands/privacyCommand.test.d.ts +0 -6
  461. package/dist/src/ui/commands/privacyCommand.test.js +0 -32
  462. package/dist/src/ui/commands/privacyCommand.test.js.map +0 -1
  463. package/dist/src/ui/commands/quitCommand.test.d.ts +0 -6
  464. package/dist/src/ui/commands/quitCommand.test.js +0 -95
  465. package/dist/src/ui/commands/quitCommand.test.js.map +0 -1
  466. package/dist/src/ui/commands/restoreCommand.test.d.ts +0 -6
  467. package/dist/src/ui/commands/restoreCommand.test.js +0 -193
  468. package/dist/src/ui/commands/restoreCommand.test.js.map +0 -1
  469. package/dist/src/ui/commands/resumeCommand.test.d.ts +0 -6
  470. package/dist/src/ui/commands/resumeCommand.test.js +0 -28
  471. package/dist/src/ui/commands/resumeCommand.test.js.map +0 -1
  472. package/dist/src/ui/commands/rewindCommand.test.d.ts +0 -6
  473. package/dist/src/ui/commands/rewindCommand.test.js +0 -256
  474. package/dist/src/ui/commands/rewindCommand.test.js.map +0 -1
  475. package/dist/src/ui/commands/settingsCommand.test.d.ts +0 -6
  476. package/dist/src/ui/commands/settingsCommand.test.js +0 -30
  477. package/dist/src/ui/commands/settingsCommand.test.js.map +0 -1
  478. package/dist/src/ui/commands/setupGithubCommand.test.d.ts +0 -6
  479. package/dist/src/ui/commands/setupGithubCommand.test.js +0 -238
  480. package/dist/src/ui/commands/setupGithubCommand.test.js.map +0 -1
  481. package/dist/src/ui/commands/skillsCommand.test.d.ts +0 -6
  482. package/dist/src/ui/commands/skillsCommand.test.js +0 -500
  483. package/dist/src/ui/commands/skillsCommand.test.js.map +0 -1
  484. package/dist/src/ui/commands/statsCommand.test.d.ts +0 -6
  485. package/dist/src/ui/commands/statsCommand.test.js +0 -122
  486. package/dist/src/ui/commands/statsCommand.test.js.map +0 -1
  487. package/dist/src/ui/commands/tasksCommand.test.d.ts +0 -6
  488. package/dist/src/ui/commands/tasksCommand.test.js +0 -30
  489. package/dist/src/ui/commands/tasksCommand.test.js.map +0 -1
  490. package/dist/src/ui/commands/terminalSetupCommand.test.d.ts +0 -6
  491. package/dist/src/ui/commands/terminalSetupCommand.test.js +0 -66
  492. package/dist/src/ui/commands/terminalSetupCommand.test.js.map +0 -1
  493. package/dist/src/ui/commands/themeCommand.test.d.ts +0 -6
  494. package/dist/src/ui/commands/themeCommand.test.js +0 -32
  495. package/dist/src/ui/commands/themeCommand.test.js.map +0 -1
  496. package/dist/src/ui/commands/toolsCommand.test.d.ts +0 -6
  497. package/dist/src/ui/commands/toolsCommand.test.js +0 -187
  498. package/dist/src/ui/commands/toolsCommand.test.js.map +0 -1
  499. package/dist/src/ui/commands/upgradeCommand.test.d.ts +0 -6
  500. package/dist/src/ui/commands/upgradeCommand.test.js +0 -102
  501. package/dist/src/ui/commands/upgradeCommand.test.js.map +0 -1
  502. package/dist/src/ui/components/AboutBox.test.d.ts +0 -6
  503. package/dist/src/ui/components/AboutBox.test.js +0 -63
  504. package/dist/src/ui/components/AboutBox.test.js.map +0 -1
  505. package/dist/src/ui/components/AdminSettingsChangedDialog.test.d.ts +0 -6
  506. package/dist/src/ui/components/AdminSettingsChangedDialog.test.js +0 -43
  507. package/dist/src/ui/components/AdminSettingsChangedDialog.test.js.map +0 -1
  508. package/dist/src/ui/components/AgentConfigDialog.test.d.ts +0 -6
  509. package/dist/src/ui/components/AgentConfigDialog.test.js +0 -267
  510. package/dist/src/ui/components/AgentConfigDialog.test.js.map +0 -1
  511. package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.d.ts +0 -6
  512. package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.js +0 -196
  513. package/dist/src/ui/components/AlternateBufferQuittingDisplay.test.js.map +0 -1
  514. package/dist/src/ui/components/AnsiOutput.test.d.ts +0 -6
  515. package/dist/src/ui/components/AnsiOutput.test.js +0 -142
  516. package/dist/src/ui/components/AnsiOutput.test.js.map +0 -1
  517. package/dist/src/ui/components/AppHeader.test.d.ts +0 -6
  518. package/dist/src/ui/components/AppHeader.test.js +0 -212
  519. package/dist/src/ui/components/AppHeader.test.js.map +0 -1
  520. package/dist/src/ui/components/AppHeaderIcon.test.d.ts +0 -6
  521. package/dist/src/ui/components/AppHeaderIcon.test.js +0 -39
  522. package/dist/src/ui/components/AppHeaderIcon.test.js.map +0 -1
  523. package/dist/src/ui/components/ApprovalModeIndicator.test.d.ts +0 -6
  524. package/dist/src/ui/components/ApprovalModeIndicator.test.js +0 -37
  525. package/dist/src/ui/components/ApprovalModeIndicator.test.js.map +0 -1
  526. package/dist/src/ui/components/AskUserDialog.test.d.ts +0 -6
  527. package/dist/src/ui/components/AskUserDialog.test.js +0 -1121
  528. package/dist/src/ui/components/AskUserDialog.test.js.map +0 -1
  529. package/dist/src/ui/components/BackgroundTaskDisplay.test.d.ts +0 -6
  530. package/dist/src/ui/components/BackgroundTaskDisplay.test.js +0 -209
  531. package/dist/src/ui/components/BackgroundTaskDisplay.test.js.map +0 -1
  532. package/dist/src/ui/components/Banner.test.d.ts +0 -6
  533. package/dist/src/ui/components/Banner.test.js +0 -29
  534. package/dist/src/ui/components/Banner.test.js.map +0 -1
  535. package/dist/src/ui/components/BubblingRegression.test.d.ts +0 -6
  536. package/dist/src/ui/components/BubblingRegression.test.js +0 -60
  537. package/dist/src/ui/components/BubblingRegression.test.js.map +0 -1
  538. package/dist/src/ui/components/Checklist.test.d.ts +0 -6
  539. package/dist/src/ui/components/Checklist.test.js +0 -46
  540. package/dist/src/ui/components/Checklist.test.js.map +0 -1
  541. package/dist/src/ui/components/ChecklistItem.test.d.ts +0 -6
  542. package/dist/src/ui/components/ChecklistItem.test.js +0 -40
  543. package/dist/src/ui/components/ChecklistItem.test.js.map +0 -1
  544. package/dist/src/ui/components/CliSpinner.test.d.ts +0 -6
  545. package/dist/src/ui/components/CliSpinner.test.js +0 -32
  546. package/dist/src/ui/components/CliSpinner.test.js.map +0 -1
  547. package/dist/src/ui/components/ColorsDisplay.test.d.ts +0 -6
  548. package/dist/src/ui/components/ColorsDisplay.test.js +0 -107
  549. package/dist/src/ui/components/ColorsDisplay.test.js.map +0 -1
  550. package/dist/src/ui/components/Composer.test.d.ts +0 -6
  551. package/dist/src/ui/components/Composer.test.js +0 -853
  552. package/dist/src/ui/components/Composer.test.js.map +0 -1
  553. package/dist/src/ui/components/ConfigInitDisplay.test.d.ts +0 -6
  554. package/dist/src/ui/components/ConfigInitDisplay.test.js +0 -118
  555. package/dist/src/ui/components/ConfigInitDisplay.test.js.map +0 -1
  556. package/dist/src/ui/components/ConsentPrompt.test.d.ts +0 -6
  557. package/dist/src/ui/components/ConsentPrompt.test.js +0 -80
  558. package/dist/src/ui/components/ConsentPrompt.test.js.map +0 -1
  559. package/dist/src/ui/components/ConsoleSummaryDisplay.test.d.ts +0 -6
  560. package/dist/src/ui/components/ConsoleSummaryDisplay.test.js +0 -28
  561. package/dist/src/ui/components/ConsoleSummaryDisplay.test.js.map +0 -1
  562. package/dist/src/ui/components/ContextSummaryDisplay.test.d.ts +0 -6
  563. package/dist/src/ui/components/ContextSummaryDisplay.test.js +0 -81
  564. package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +0 -1
  565. package/dist/src/ui/components/ContextUsageDisplay.test.d.ts +0 -6
  566. package/dist/src/ui/components/ContextUsageDisplay.test.js +0 -50
  567. package/dist/src/ui/components/ContextUsageDisplay.test.js.map +0 -1
  568. package/dist/src/ui/components/CopyModeWarning.test.d.ts +0 -6
  569. package/dist/src/ui/components/CopyModeWarning.test.js +0 -35
  570. package/dist/src/ui/components/CopyModeWarning.test.js.map +0 -1
  571. package/dist/src/ui/components/DebugProfiler.test.d.ts +0 -6
  572. package/dist/src/ui/components/DebugProfiler.test.js +0 -228
  573. package/dist/src/ui/components/DebugProfiler.test.js.map +0 -1
  574. package/dist/src/ui/components/DetailedMessagesDisplay.test.d.ts +0 -6
  575. package/dist/src/ui/components/DetailedMessagesDisplay.test.js +0 -81
  576. package/dist/src/ui/components/DetailedMessagesDisplay.test.js.map +0 -1
  577. package/dist/src/ui/components/DialogManager.test.d.ts +0 -6
  578. package/dist/src/ui/components/DialogManager.test.js +0 -187
  579. package/dist/src/ui/components/DialogManager.test.js.map +0 -1
  580. package/dist/src/ui/components/EditorSettingsDialog.test.d.ts +0 -6
  581. package/dist/src/ui/components/EditorSettingsDialog.test.js +0 -145
  582. package/dist/src/ui/components/EditorSettingsDialog.test.js.map +0 -1
  583. package/dist/src/ui/components/EmptyWalletDialog.test.d.ts +0 -6
  584. package/dist/src/ui/components/EmptyWalletDialog.test.js +0 -116
  585. package/dist/src/ui/components/EmptyWalletDialog.test.js.map +0 -1
  586. package/dist/src/ui/components/ExitPlanModeDialog.test.d.ts +0 -6
  587. package/dist/src/ui/components/ExitPlanModeDialog.test.js +0 -443
  588. package/dist/src/ui/components/ExitPlanModeDialog.test.js.map +0 -1
  589. package/dist/src/ui/components/ExitWarning.test.d.ts +0 -6
  590. package/dist/src/ui/components/ExitWarning.test.js +0 -58
  591. package/dist/src/ui/components/ExitWarning.test.js.map +0 -1
  592. package/dist/src/ui/components/FolderTrustDialog.test.d.ts +0 -6
  593. package/dist/src/ui/components/FolderTrustDialog.test.js +0 -342
  594. package/dist/src/ui/components/FolderTrustDialog.test.js.map +0 -1
  595. package/dist/src/ui/components/Footer.test.d.ts +0 -6
  596. package/dist/src/ui/components/Footer.test.js +0 -806
  597. package/dist/src/ui/components/Footer.test.js.map +0 -1
  598. package/dist/src/ui/components/FooterConfigDialog.test.d.ts +0 -6
  599. package/dist/src/ui/components/FooterConfigDialog.test.js +0 -191
  600. package/dist/src/ui/components/FooterConfigDialog.test.js.map +0 -1
  601. package/dist/src/ui/components/GeminiRespondingSpinner.test.d.ts +0 -6
  602. package/dist/src/ui/components/GeminiRespondingSpinner.test.js +0 -63
  603. package/dist/src/ui/components/GeminiRespondingSpinner.test.js.map +0 -1
  604. package/dist/src/ui/components/GradientRegression.test.d.ts +0 -6
  605. package/dist/src/ui/components/GradientRegression.test.js +0 -116
  606. package/dist/src/ui/components/GradientRegression.test.js.map +0 -1
  607. package/dist/src/ui/components/Header.test.d.ts +0 -6
  608. package/dist/src/ui/components/Header.test.js +0 -131
  609. package/dist/src/ui/components/Header.test.js.map +0 -1
  610. package/dist/src/ui/components/Help.test.d.ts +0 -6
  611. package/dist/src/ui/components/Help.test.js +0 -67
  612. package/dist/src/ui/components/Help.test.js.map +0 -1
  613. package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +0 -6
  614. package/dist/src/ui/components/HistoryItemDisplay.test.js +0 -302
  615. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +0 -1
  616. package/dist/src/ui/components/HookStatusDisplay.test.d.ts +0 -6
  617. package/dist/src/ui/components/HookStatusDisplay.test.js +0 -77
  618. package/dist/src/ui/components/HookStatusDisplay.test.js.map +0 -1
  619. package/dist/src/ui/components/HooksDialog.test.d.ts +0 -6
  620. package/dist/src/ui/components/HooksDialog.test.js +0 -175
  621. package/dist/src/ui/components/HooksDialog.test.js.map +0 -1
  622. package/dist/src/ui/components/IdeTrustChangeDialog.test.d.ts +0 -6
  623. package/dist/src/ui/components/IdeTrustChangeDialog.test.js +0 -78
  624. package/dist/src/ui/components/IdeTrustChangeDialog.test.js.map +0 -1
  625. package/dist/src/ui/components/InboxDialog.test.d.ts +0 -6
  626. package/dist/src/ui/components/InboxDialog.test.js +0 -804
  627. package/dist/src/ui/components/InboxDialog.test.js.map +0 -1
  628. package/dist/src/ui/components/InputPrompt.test.d.ts +0 -17
  629. package/dist/src/ui/components/InputPrompt.test.js +0 -4078
  630. package/dist/src/ui/components/InputPrompt.test.js.map +0 -1
  631. package/dist/src/ui/components/LoadingIndicator.test.d.ts +0 -6
  632. package/dist/src/ui/components/LoadingIndicator.test.js +0 -325
  633. package/dist/src/ui/components/LoadingIndicator.test.js.map +0 -1
  634. package/dist/src/ui/components/LogoutConfirmationDialog.test.d.ts +0 -6
  635. package/dist/src/ui/components/LogoutConfirmationDialog.test.js +0 -74
  636. package/dist/src/ui/components/LogoutConfirmationDialog.test.js.map +0 -1
  637. package/dist/src/ui/components/LoopDetectionConfirmation.test.d.ts +0 -6
  638. package/dist/src/ui/components/LoopDetectionConfirmation.test.js +0 -27
  639. package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +0 -1
  640. package/dist/src/ui/components/MainContent.test.d.ts +0 -6
  641. package/dist/src/ui/components/MainContent.test.js +0 -750
  642. package/dist/src/ui/components/MainContent.test.js.map +0 -1
  643. package/dist/src/ui/components/MemoryUsageDisplay.test.d.ts +0 -6
  644. package/dist/src/ui/components/MemoryUsageDisplay.test.js +0 -52
  645. package/dist/src/ui/components/MemoryUsageDisplay.test.js.map +0 -1
  646. package/dist/src/ui/components/ModelDialog.test.d.ts +0 -6
  647. package/dist/src/ui/components/ModelDialog.test.js +0 -356
  648. package/dist/src/ui/components/ModelDialog.test.js.map +0 -1
  649. package/dist/src/ui/components/ModelQuotaDisplay.test.d.ts +0 -6
  650. package/dist/src/ui/components/ModelQuotaDisplay.test.js +0 -62
  651. package/dist/src/ui/components/ModelQuotaDisplay.test.js.map +0 -1
  652. package/dist/src/ui/components/ModelStatsDisplay.test.d.ts +0 -6
  653. package/dist/src/ui/components/ModelStatsDisplay.test.js +0 -651
  654. package/dist/src/ui/components/ModelStatsDisplay.test.js.map +0 -1
  655. package/dist/src/ui/components/MultiFolderTrustDialog.test.d.ts +0 -6
  656. package/dist/src/ui/components/MultiFolderTrustDialog.test.js +0 -177
  657. package/dist/src/ui/components/MultiFolderTrustDialog.test.js.map +0 -1
  658. package/dist/src/ui/components/NewAgentsNotification.test.d.ts +0 -6
  659. package/dist/src/ui/components/NewAgentsNotification.test.js +0 -83
  660. package/dist/src/ui/components/NewAgentsNotification.test.js.map +0 -1
  661. package/dist/src/ui/components/Notifications.test.d.ts +0 -6
  662. package/dist/src/ui/components/Notifications.test.js +0 -285
  663. package/dist/src/ui/components/Notifications.test.js.map +0 -1
  664. package/dist/src/ui/components/OverageMenuDialog.test.d.ts +0 -6
  665. package/dist/src/ui/components/OverageMenuDialog.test.js +0 -118
  666. package/dist/src/ui/components/OverageMenuDialog.test.js.map +0 -1
  667. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.d.ts +0 -6
  668. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +0 -181
  669. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +0 -1
  670. package/dist/src/ui/components/PolicyUpdateDialog.test.d.ts +0 -6
  671. package/dist/src/ui/components/PolicyUpdateDialog.test.js +0 -92
  672. package/dist/src/ui/components/PolicyUpdateDialog.test.js.map +0 -1
  673. package/dist/src/ui/components/ProQuotaDialog.test.d.ts +0 -6
  674. package/dist/src/ui/components/ProQuotaDialog.test.js +0 -222
  675. package/dist/src/ui/components/ProQuotaDialog.test.js.map +0 -1
  676. package/dist/src/ui/components/ProgressBar.test.d.ts +0 -6
  677. package/dist/src/ui/components/ProgressBar.test.js +0 -28
  678. package/dist/src/ui/components/ProgressBar.test.js.map +0 -1
  679. package/dist/src/ui/components/QueuedMessageDisplay.test.d.ts +0 -6
  680. package/dist/src/ui/components/QueuedMessageDisplay.test.js +0 -65
  681. package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +0 -1
  682. package/dist/src/ui/components/QuittingDisplay.test.d.ts +0 -6
  683. package/dist/src/ui/components/QuittingDisplay.test.js +0 -60
  684. package/dist/src/ui/components/QuittingDisplay.test.js.map +0 -1
  685. package/dist/src/ui/components/QuotaDisplay.test.d.ts +0 -6
  686. package/dist/src/ui/components/QuotaDisplay.test.js +0 -68
  687. package/dist/src/ui/components/QuotaDisplay.test.js.map +0 -1
  688. package/dist/src/ui/components/RawMarkdownIndicator.test.d.ts +0 -6
  689. package/dist/src/ui/components/RawMarkdownIndicator.test.js +0 -38
  690. package/dist/src/ui/components/RawMarkdownIndicator.test.js.map +0 -1
  691. package/dist/src/ui/components/RewindConfirmation.test.d.ts +0 -6
  692. package/dist/src/ui/components/RewindConfirmation.test.js +0 -57
  693. package/dist/src/ui/components/RewindConfirmation.test.js.map +0 -1
  694. package/dist/src/ui/components/RewindViewer.test.d.ts +0 -6
  695. package/dist/src/ui/components/RewindViewer.test.js +0 -334
  696. package/dist/src/ui/components/RewindViewer.test.js.map +0 -1
  697. package/dist/src/ui/components/SessionBrowser/SessionBrowserSearchNav.test.d.ts +0 -6
  698. package/dist/src/ui/components/SessionBrowser/SessionBrowserSearchNav.test.js +0 -47
  699. package/dist/src/ui/components/SessionBrowser/SessionBrowserSearchNav.test.js.map +0 -1
  700. package/dist/src/ui/components/SessionBrowser/SessionBrowserStates.test.d.ts +0 -6
  701. package/dist/src/ui/components/SessionBrowser/SessionBrowserStates.test.js +0 -27
  702. package/dist/src/ui/components/SessionBrowser/SessionBrowserStates.test.js.map +0 -1
  703. package/dist/src/ui/components/SessionBrowser/utils.test.d.ts +0 -6
  704. package/dist/src/ui/components/SessionBrowser/utils.test.js +0 -108
  705. package/dist/src/ui/components/SessionBrowser/utils.test.js.map +0 -1
  706. package/dist/src/ui/components/SessionBrowser.test.d.ts +0 -6
  707. package/dist/src/ui/components/SessionBrowser.test.js +0 -266
  708. package/dist/src/ui/components/SessionBrowser.test.js.map +0 -1
  709. package/dist/src/ui/components/SessionSummaryDisplay.test.d.ts +0 -6
  710. package/dist/src/ui/components/SessionSummaryDisplay.test.js +0 -164
  711. package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +0 -1
  712. package/dist/src/ui/components/SettingsDialog.test.d.ts +0 -6
  713. package/dist/src/ui/components/SettingsDialog.test.js +0 -1499
  714. package/dist/src/ui/components/SettingsDialog.test.js.map +0 -1
  715. package/dist/src/ui/components/ShellInputPrompt.test.d.ts +0 -6
  716. package/dist/src/ui/components/ShellInputPrompt.test.js +0 -201
  717. package/dist/src/ui/components/ShellInputPrompt.test.js.map +0 -1
  718. package/dist/src/ui/components/ShellModeIndicator.test.d.ts +0 -6
  719. package/dist/src/ui/components/ShellModeIndicator.test.js +0 -18
  720. package/dist/src/ui/components/ShellModeIndicator.test.js.map +0 -1
  721. package/dist/src/ui/components/ShortcutsHelp.test.d.ts +0 -6
  722. package/dist/src/ui/components/ShortcutsHelp.test.js +0 -45
  723. package/dist/src/ui/components/ShortcutsHelp.test.js.map +0 -1
  724. package/dist/src/ui/components/ShowMoreLines.test.d.ts +0 -6
  725. package/dist/src/ui/components/ShowMoreLines.test.js +0 -79
  726. package/dist/src/ui/components/ShowMoreLines.test.js.map +0 -1
  727. package/dist/src/ui/components/ShowMoreLinesLayout.test.d.ts +0 -1
  728. package/dist/src/ui/components/ShowMoreLinesLayout.test.js +0 -68
  729. package/dist/src/ui/components/ShowMoreLinesLayout.test.js.map +0 -1
  730. package/dist/src/ui/components/StatsDisplay.test.d.ts +0 -6
  731. package/dist/src/ui/components/StatsDisplay.test.js +0 -489
  732. package/dist/src/ui/components/StatsDisplay.test.js.map +0 -1
  733. package/dist/src/ui/components/StatusDisplay.test.d.ts +0 -6
  734. package/dist/src/ui/components/StatusDisplay.test.js +0 -117
  735. package/dist/src/ui/components/StatusDisplay.test.js.map +0 -1
  736. package/dist/src/ui/components/StatusRow.test.d.ts +0 -6
  737. package/dist/src/ui/components/StatusRow.test.js +0 -99
  738. package/dist/src/ui/components/StatusRow.test.js.map +0 -1
  739. package/dist/src/ui/components/StickyHeader.test.d.ts +0 -6
  740. package/dist/src/ui/components/StickyHeader.test.js +0 -19
  741. package/dist/src/ui/components/StickyHeader.test.js.map +0 -1
  742. package/dist/src/ui/components/SuggestionsDisplay.test.d.ts +0 -6
  743. package/dist/src/ui/components/SuggestionsDisplay.test.js +0 -82
  744. package/dist/src/ui/components/SuggestionsDisplay.test.js.map +0 -1
  745. package/dist/src/ui/components/Table.test.d.ts +0 -6
  746. package/dist/src/ui/components/Table.test.js +0 -72
  747. package/dist/src/ui/components/Table.test.js.map +0 -1
  748. package/dist/src/ui/components/ThemeDialog.test.d.ts +0 -6
  749. package/dist/src/ui/components/ThemeDialog.test.js +0 -162
  750. package/dist/src/ui/components/ThemeDialog.test.js.map +0 -1
  751. package/dist/src/ui/components/ThemedGradient.test.d.ts +0 -6
  752. package/dist/src/ui/components/ThemedGradient.test.js +0 -35
  753. package/dist/src/ui/components/ThemedGradient.test.js.map +0 -1
  754. package/dist/src/ui/components/Tips.test.d.ts +0 -6
  755. package/dist/src/ui/components/Tips.test.js +0 -23
  756. package/dist/src/ui/components/Tips.test.js.map +0 -1
  757. package/dist/src/ui/components/ToastDisplay.test.d.ts +0 -6
  758. package/dist/src/ui/components/ToastDisplay.test.js +0 -167
  759. package/dist/src/ui/components/ToastDisplay.test.js.map +0 -1
  760. package/dist/src/ui/components/ToolConfirmationQueue.test.d.ts +0 -6
  761. package/dist/src/ui/components/ToolConfirmationQueue.test.js +0 -444
  762. package/dist/src/ui/components/ToolConfirmationQueue.test.js.map +0 -1
  763. package/dist/src/ui/components/ToolStatsDisplay.test.d.ts +0 -6
  764. package/dist/src/ui/components/ToolStatsDisplay.test.js +0 -234
  765. package/dist/src/ui/components/ToolStatsDisplay.test.js.map +0 -1
  766. package/dist/src/ui/components/UpdateNotification.test.d.ts +0 -6
  767. package/dist/src/ui/components/UpdateNotification.test.js +0 -17
  768. package/dist/src/ui/components/UpdateNotification.test.js.map +0 -1
  769. package/dist/src/ui/components/UserIdentity.test.d.ts +0 -6
  770. package/dist/src/ui/components/UserIdentity.test.js +0 -138
  771. package/dist/src/ui/components/UserIdentity.test.js.map +0 -1
  772. package/dist/src/ui/components/ValidationDialog.test.d.ts +0 -6
  773. package/dist/src/ui/components/ValidationDialog.test.js +0 -162
  774. package/dist/src/ui/components/ValidationDialog.test.js.map +0 -1
  775. package/dist/src/ui/components/VoiceModelDialog.test.d.ts +0 -6
  776. package/dist/src/ui/components/VoiceModelDialog.test.js +0 -68
  777. package/dist/src/ui/components/VoiceModelDialog.test.js.map +0 -1
  778. package/dist/src/ui/components/messages/CompressionMessage.test.d.ts +0 -6
  779. package/dist/src/ui/components/messages/CompressionMessage.test.js +0 -180
  780. package/dist/src/ui/components/messages/CompressionMessage.test.js.map +0 -1
  781. package/dist/src/ui/components/messages/DenseToolMessage.test.d.ts +0 -6
  782. package/dist/src/ui/components/messages/DenseToolMessage.test.js +0 -406
  783. package/dist/src/ui/components/messages/DenseToolMessage.test.js.map +0 -1
  784. package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +0 -6
  785. package/dist/src/ui/components/messages/DiffRenderer.test.js +0 -269
  786. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +0 -1
  787. package/dist/src/ui/components/messages/ErrorMessage.test.d.ts +0 -6
  788. package/dist/src/ui/components/messages/ErrorMessage.test.js +0 -25
  789. package/dist/src/ui/components/messages/ErrorMessage.test.js.map +0 -1
  790. package/dist/src/ui/components/messages/ExportSessionMessage.test.d.ts +0 -6
  791. package/dist/src/ui/components/messages/ExportSessionMessage.test.js +0 -32
  792. package/dist/src/ui/components/messages/ExportSessionMessage.test.js.map +0 -1
  793. package/dist/src/ui/components/messages/GeminiMessage.test.d.ts +0 -6
  794. package/dist/src/ui/components/messages/GeminiMessage.test.js +0 -46
  795. package/dist/src/ui/components/messages/GeminiMessage.test.js.map +0 -1
  796. package/dist/src/ui/components/messages/HintMessage.test.d.ts +0 -6
  797. package/dist/src/ui/components/messages/HintMessage.test.js +0 -42
  798. package/dist/src/ui/components/messages/HintMessage.test.js.map +0 -1
  799. package/dist/src/ui/components/messages/InfoMessage.test.d.ts +0 -6
  800. package/dist/src/ui/components/messages/InfoMessage.test.js +0 -31
  801. package/dist/src/ui/components/messages/InfoMessage.test.js.map +0 -1
  802. package/dist/src/ui/components/messages/RedirectionConfirmation.test.d.ts +0 -6
  803. package/dist/src/ui/components/messages/RedirectionConfirmation.test.js +0 -35
  804. package/dist/src/ui/components/messages/RedirectionConfirmation.test.js.map +0 -1
  805. package/dist/src/ui/components/messages/ShellToolMessage.test.d.ts +0 -6
  806. package/dist/src/ui/components/messages/ShellToolMessage.test.js +0 -290
  807. package/dist/src/ui/components/messages/ShellToolMessage.test.js.map +0 -1
  808. package/dist/src/ui/components/messages/SubagentGroupDisplay.test.d.ts +0 -1
  809. package/dist/src/ui/components/messages/SubagentGroupDisplay.test.js +0 -92
  810. package/dist/src/ui/components/messages/SubagentGroupDisplay.test.js.map +0 -1
  811. package/dist/src/ui/components/messages/SubagentHistoryMessage.test.d.ts +0 -6
  812. package/dist/src/ui/components/messages/SubagentHistoryMessage.test.js +0 -69
  813. package/dist/src/ui/components/messages/SubagentHistoryMessage.test.js.map +0 -1
  814. package/dist/src/ui/components/messages/SubagentProgressDisplay.test.d.ts +0 -6
  815. package/dist/src/ui/components/messages/SubagentProgressDisplay.test.js +0 -164
  816. package/dist/src/ui/components/messages/SubagentProgressDisplay.test.js.map +0 -1
  817. package/dist/src/ui/components/messages/ThinkingMessage.test.d.ts +0 -6
  818. package/dist/src/ui/components/messages/ThinkingMessage.test.js +0 -104
  819. package/dist/src/ui/components/messages/ThinkingMessage.test.js.map +0 -1
  820. package/dist/src/ui/components/messages/Todo.test.d.ts +0 -6
  821. package/dist/src/ui/components/messages/Todo.test.js +0 -129
  822. package/dist/src/ui/components/messages/Todo.test.js.map +0 -1
  823. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +0 -6
  824. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +0 -558
  825. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +0 -1
  826. package/dist/src/ui/components/messages/ToolGroupDisplay.test.d.ts +0 -6
  827. package/dist/src/ui/components/messages/ToolGroupDisplay.test.js +0 -210
  828. package/dist/src/ui/components/messages/ToolGroupDisplay.test.js.map +0 -1
  829. package/dist/src/ui/components/messages/ToolGroupMessage.compact.test.d.ts +0 -6
  830. package/dist/src/ui/components/messages/ToolGroupMessage.compact.test.js +0 -147
  831. package/dist/src/ui/components/messages/ToolGroupMessage.compact.test.js.map +0 -1
  832. package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +0 -6
  833. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +0 -828
  834. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +0 -1
  835. package/dist/src/ui/components/messages/ToolGroupMessageRegression.test.d.ts +0 -6
  836. package/dist/src/ui/components/messages/ToolGroupMessageRegression.test.js +0 -101
  837. package/dist/src/ui/components/messages/ToolGroupMessageRegression.test.js.map +0 -1
  838. package/dist/src/ui/components/messages/ToolMessage.test.d.ts +0 -6
  839. package/dist/src/ui/components/messages/ToolMessage.test.js +0 -292
  840. package/dist/src/ui/components/messages/ToolMessage.test.js.map +0 -1
  841. package/dist/src/ui/components/messages/ToolMessageFocusHint.test.d.ts +0 -6
  842. package/dist/src/ui/components/messages/ToolMessageFocusHint.test.js +0 -96
  843. package/dist/src/ui/components/messages/ToolMessageFocusHint.test.js.map +0 -1
  844. package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.d.ts +0 -6
  845. package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js +0 -72
  846. package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js.map +0 -1
  847. package/dist/src/ui/components/messages/ToolOverflowConsistencyChecks.test.d.ts +0 -6
  848. package/dist/src/ui/components/messages/ToolOverflowConsistencyChecks.test.js +0 -88
  849. package/dist/src/ui/components/messages/ToolOverflowConsistencyChecks.test.js.map +0 -1
  850. package/dist/src/ui/components/messages/ToolResultDisplay.test.d.ts +0 -6
  851. package/dist/src/ui/components/messages/ToolResultDisplay.test.js +0 -333
  852. package/dist/src/ui/components/messages/ToolResultDisplay.test.js.map +0 -1
  853. package/dist/src/ui/components/messages/ToolResultDisplayOverflow.test.d.ts +0 -6
  854. package/dist/src/ui/components/messages/ToolResultDisplayOverflow.test.js +0 -77
  855. package/dist/src/ui/components/messages/ToolResultDisplayOverflow.test.js.map +0 -1
  856. package/dist/src/ui/components/messages/ToolShared.test.d.ts +0 -6
  857. package/dist/src/ui/components/messages/ToolShared.test.js +0 -65
  858. package/dist/src/ui/components/messages/ToolShared.test.js.map +0 -1
  859. package/dist/src/ui/components/messages/ToolStickyHeaderRegression.test.d.ts +0 -6
  860. package/dist/src/ui/components/messages/ToolStickyHeaderRegression.test.js +0 -142
  861. package/dist/src/ui/components/messages/ToolStickyHeaderRegression.test.js.map +0 -1
  862. package/dist/src/ui/components/messages/TopicMessage.test.d.ts +0 -6
  863. package/dist/src/ui/components/messages/TopicMessage.test.js +0 -77
  864. package/dist/src/ui/components/messages/TopicMessage.test.js.map +0 -1
  865. package/dist/src/ui/components/messages/UserMessage.test.d.ts +0 -6
  866. package/dist/src/ui/components/messages/UserMessage.test.js +0 -67
  867. package/dist/src/ui/components/messages/UserMessage.test.js.map +0 -1
  868. package/dist/src/ui/components/messages/UserShellMessage.test.d.ts +0 -6
  869. package/dist/src/ui/components/messages/UserShellMessage.test.js +0 -40
  870. package/dist/src/ui/components/messages/UserShellMessage.test.js.map +0 -1
  871. package/dist/src/ui/components/messages/WarningMessage.test.d.ts +0 -6
  872. package/dist/src/ui/components/messages/WarningMessage.test.js +0 -25
  873. package/dist/src/ui/components/messages/WarningMessage.test.js.map +0 -1
  874. package/dist/src/ui/components/shared/BaseSelectionList.test.d.ts +0 -6
  875. package/dist/src/ui/components/shared/BaseSelectionList.test.js +0 -441
  876. package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +0 -1
  877. package/dist/src/ui/components/shared/BaseSettingsDialog.test.d.ts +0 -6
  878. package/dist/src/ui/components/shared/BaseSettingsDialog.test.js +0 -710
  879. package/dist/src/ui/components/shared/BaseSettingsDialog.test.js.map +0 -1
  880. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.d.ts +0 -6
  881. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.js +0 -89
  882. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.js.map +0 -1
  883. package/dist/src/ui/components/shared/EnumSelector.test.d.ts +0 -6
  884. package/dist/src/ui/components/shared/EnumSelector.test.js +0 -83
  885. package/dist/src/ui/components/shared/EnumSelector.test.js.map +0 -1
  886. package/dist/src/ui/components/shared/ExpandableText.test.d.ts +0 -6
  887. package/dist/src/ui/components/shared/ExpandableText.test.js +0 -95
  888. package/dist/src/ui/components/shared/ExpandableText.test.js.map +0 -1
  889. package/dist/src/ui/components/shared/HalfLinePaddedBox.test.d.ts +0 -1
  890. package/dist/src/ui/components/shared/HalfLinePaddedBox.test.js +0 -47
  891. package/dist/src/ui/components/shared/HalfLinePaddedBox.test.js.map +0 -1
  892. package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +0 -6
  893. package/dist/src/ui/components/shared/MaxSizedBox.test.js +0 -161
  894. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +0 -1
  895. package/dist/src/ui/components/shared/RadioButtonSelect.test.d.ts +0 -6
  896. package/dist/src/ui/components/shared/RadioButtonSelect.test.js +0 -146
  897. package/dist/src/ui/components/shared/RadioButtonSelect.test.js.map +0 -1
  898. package/dist/src/ui/components/shared/Scrollable.test.d.ts +0 -6
  899. package/dist/src/ui/components/shared/Scrollable.test.js +0 -143
  900. package/dist/src/ui/components/shared/Scrollable.test.js.map +0 -1
  901. package/dist/src/ui/components/shared/ScrollableList.test.d.ts +0 -6
  902. package/dist/src/ui/components/shared/ScrollableList.test.js +0 -438
  903. package/dist/src/ui/components/shared/ScrollableList.test.js.map +0 -1
  904. package/dist/src/ui/components/shared/SearchableList.test.d.ts +0 -6
  905. package/dist/src/ui/components/shared/SearchableList.test.js +0 -169
  906. package/dist/src/ui/components/shared/SearchableList.test.js.map +0 -1
  907. package/dist/src/ui/components/shared/SectionHeader.test.d.ts +0 -6
  908. package/dist/src/ui/components/shared/SectionHeader.test.js +0 -42
  909. package/dist/src/ui/components/shared/SectionHeader.test.js.map +0 -1
  910. package/dist/src/ui/components/shared/SlicingMaxSizedBox.test.d.ts +0 -6
  911. package/dist/src/ui/components/shared/SlicingMaxSizedBox.test.js +0 -54
  912. package/dist/src/ui/components/shared/SlicingMaxSizedBox.test.js.map +0 -1
  913. package/dist/src/ui/components/shared/TabHeader.test.d.ts +0 -6
  914. package/dist/src/ui/components/shared/TabHeader.test.js +0 -144
  915. package/dist/src/ui/components/shared/TabHeader.test.js.map +0 -1
  916. package/dist/src/ui/components/shared/TextInput.test.d.ts +0 -6
  917. package/dist/src/ui/components/shared/TextInput.test.js +0 -353
  918. package/dist/src/ui/components/shared/TextInput.test.js.map +0 -1
  919. package/dist/src/ui/components/shared/VirtualizedList.test.d.ts +0 -6
  920. package/dist/src/ui/components/shared/VirtualizedList.test.js +0 -174
  921. package/dist/src/ui/components/shared/VirtualizedList.test.js.map +0 -1
  922. package/dist/src/ui/components/shared/performance.test.d.ts +0 -1
  923. package/dist/src/ui/components/shared/performance.test.js +0 -74
  924. package/dist/src/ui/components/shared/performance.test.js.map +0 -1
  925. package/dist/src/ui/components/shared/text-buffer.test.d.ts +0 -6
  926. package/dist/src/ui/components/shared/text-buffer.test.js +0 -2965
  927. package/dist/src/ui/components/shared/text-buffer.test.js.map +0 -1
  928. package/dist/src/ui/components/shared/vim-buffer-actions.test.d.ts +0 -6
  929. package/dist/src/ui/components/shared/vim-buffer-actions.test.js +0 -2272
  930. package/dist/src/ui/components/shared/vim-buffer-actions.test.js.map +0 -1
  931. package/dist/src/ui/components/views/ChatList.test.d.ts +0 -6
  932. package/dist/src/ui/components/views/ChatList.test.js +0 -45
  933. package/dist/src/ui/components/views/ChatList.test.js.map +0 -1
  934. package/dist/src/ui/components/views/ExtensionDetails.test.d.ts +0 -6
  935. package/dist/src/ui/components/views/ExtensionDetails.test.js +0 -154
  936. package/dist/src/ui/components/views/ExtensionDetails.test.js.map +0 -1
  937. package/dist/src/ui/components/views/ExtensionRegistryView.test.d.ts +0 -6
  938. package/dist/src/ui/components/views/ExtensionRegistryView.test.js +0 -222
  939. package/dist/src/ui/components/views/ExtensionRegistryView.test.js.map +0 -1
  940. package/dist/src/ui/components/views/ExtensionsList.test.d.ts +0 -6
  941. package/dist/src/ui/components/views/ExtensionsList.test.js +0 -145
  942. package/dist/src/ui/components/views/ExtensionsList.test.js.map +0 -1
  943. package/dist/src/ui/components/views/McpStatus.test.d.ts +0 -6
  944. package/dist/src/ui/components/views/McpStatus.test.js +0 -174
  945. package/dist/src/ui/components/views/McpStatus.test.js.map +0 -1
  946. package/dist/src/ui/components/views/SkillsList.test.d.ts +0 -6
  947. package/dist/src/ui/components/views/SkillsList.test.js +0 -99
  948. package/dist/src/ui/components/views/SkillsList.test.js.map +0 -1
  949. package/dist/src/ui/components/views/ToolsList.test.d.ts +0 -6
  950. package/dist/src/ui/components/views/ToolsList.test.js +0 -45
  951. package/dist/src/ui/components/views/ToolsList.test.js.map +0 -1
  952. package/dist/src/ui/contexts/KeypressContext.test.d.ts +0 -6
  953. package/dist/src/ui/contexts/KeypressContext.test.js +0 -1133
  954. package/dist/src/ui/contexts/KeypressContext.test.js.map +0 -1
  955. package/dist/src/ui/contexts/MouseContext.test.d.ts +0 -6
  956. package/dist/src/ui/contexts/MouseContext.test.js +0 -269
  957. package/dist/src/ui/contexts/MouseContext.test.js.map +0 -1
  958. package/dist/src/ui/contexts/ScrollProvider.drag.test.d.ts +0 -6
  959. package/dist/src/ui/contexts/ScrollProvider.drag.test.js +0 -320
  960. package/dist/src/ui/contexts/ScrollProvider.drag.test.js.map +0 -1
  961. package/dist/src/ui/contexts/ScrollProvider.test.d.ts +0 -6
  962. package/dist/src/ui/contexts/ScrollProvider.test.js +0 -478
  963. package/dist/src/ui/contexts/ScrollProvider.test.js.map +0 -1
  964. package/dist/src/ui/contexts/SessionContext.test.d.ts +0 -6
  965. package/dist/src/ui/contexts/SessionContext.test.js +0 -213
  966. package/dist/src/ui/contexts/SessionContext.test.js.map +0 -1
  967. package/dist/src/ui/contexts/SettingsContext.test.d.ts +0 -6
  968. package/dist/src/ui/contexts/SettingsContext.test.js +0 -106
  969. package/dist/src/ui/contexts/SettingsContext.test.js.map +0 -1
  970. package/dist/src/ui/contexts/TerminalContext.test.d.ts +0 -6
  971. package/dist/src/ui/contexts/TerminalContext.test.js +0 -75
  972. package/dist/src/ui/contexts/TerminalContext.test.js.map +0 -1
  973. package/dist/src/ui/contexts/ToolActionsContext.test.d.ts +0 -6
  974. package/dist/src/ui/contexts/ToolActionsContext.test.js +0 -247
  975. package/dist/src/ui/contexts/ToolActionsContext.test.js.map +0 -1
  976. package/dist/src/ui/hooks/atCommandProcessor.test.d.ts +0 -6
  977. package/dist/src/ui/hooks/atCommandProcessor.test.js +0 -1265
  978. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +0 -1
  979. package/dist/src/ui/hooks/atCommandProcessor_agents.test.d.ts +0 -6
  980. package/dist/src/ui/hooks/atCommandProcessor_agents.test.js +0 -210
  981. package/dist/src/ui/hooks/atCommandProcessor_agents.test.js.map +0 -1
  982. package/dist/src/ui/hooks/creditsFlowHandler.test.d.ts +0 -6
  983. package/dist/src/ui/hooks/creditsFlowHandler.test.js +0 -211
  984. package/dist/src/ui/hooks/creditsFlowHandler.test.js.map +0 -1
  985. package/dist/src/ui/hooks/shell-completions/gitProvider.test.d.ts +0 -6
  986. package/dist/src/ui/hooks/shell-completions/gitProvider.test.js +0 -73
  987. package/dist/src/ui/hooks/shell-completions/gitProvider.test.js.map +0 -1
  988. package/dist/src/ui/hooks/shell-completions/npmProvider.test.d.ts +0 -6
  989. package/dist/src/ui/hooks/shell-completions/npmProvider.test.js +0 -69
  990. package/dist/src/ui/hooks/shell-completions/npmProvider.test.js.map +0 -1
  991. package/dist/src/ui/hooks/shellReducer.test.d.ts +0 -6
  992. package/dist/src/ui/hooks/shellReducer.test.js +0 -341
  993. package/dist/src/ui/hooks/shellReducer.test.js.map +0 -1
  994. package/dist/src/ui/hooks/slashCommandProcessor.test.d.ts +0 -6
  995. package/dist/src/ui/hooks/slashCommandProcessor.test.js +0 -881
  996. package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +0 -1
  997. package/dist/src/ui/hooks/toolMapping.test.d.ts +0 -6
  998. package/dist/src/ui/hooks/toolMapping.test.js +0 -292
  999. package/dist/src/ui/hooks/toolMapping.test.js.map +0 -1
  1000. package/dist/src/ui/hooks/useAgentStream.test.d.ts +0 -6
  1001. package/dist/src/ui/hooks/useAgentStream.test.js +0 -161
  1002. package/dist/src/ui/hooks/useAgentStream.test.js.map +0 -1
  1003. package/dist/src/ui/hooks/useAlternateBuffer.test.d.ts +0 -6
  1004. package/dist/src/ui/hooks/useAlternateBuffer.test.js +0 -62
  1005. package/dist/src/ui/hooks/useAlternateBuffer.test.js.map +0 -1
  1006. package/dist/src/ui/hooks/useAnimatedScrollbar.test.d.ts +0 -6
  1007. package/dist/src/ui/hooks/useAnimatedScrollbar.test.js +0 -85
  1008. package/dist/src/ui/hooks/useAnimatedScrollbar.test.js.map +0 -1
  1009. package/dist/src/ui/hooks/useApprovalModeIndicator.test.d.ts +0 -6
  1010. package/dist/src/ui/hooks/useApprovalModeIndicator.test.js +0 -477
  1011. package/dist/src/ui/hooks/useApprovalModeIndicator.test.js.map +0 -1
  1012. package/dist/src/ui/hooks/useAtCompletion.test.d.ts +0 -6
  1013. package/dist/src/ui/hooks/useAtCompletion.test.js +0 -567
  1014. package/dist/src/ui/hooks/useAtCompletion.test.js.map +0 -1
  1015. package/dist/src/ui/hooks/useAtCompletion_agents.test.d.ts +0 -6
  1016. package/dist/src/ui/hooks/useAtCompletion_agents.test.js +0 -87
  1017. package/dist/src/ui/hooks/useAtCompletion_agents.test.js.map +0 -1
  1018. package/dist/src/ui/hooks/useBackgroundTaskManager.test.d.ts +0 -6
  1019. package/dist/src/ui/hooks/useBackgroundTaskManager.test.js +0 -168
  1020. package/dist/src/ui/hooks/useBackgroundTaskManager.test.js.map +0 -1
  1021. package/dist/src/ui/hooks/useBanner.test.d.ts +0 -6
  1022. package/dist/src/ui/hooks/useBanner.test.js +0 -144
  1023. package/dist/src/ui/hooks/useBanner.test.js.map +0 -1
  1024. package/dist/src/ui/hooks/useBatchedScroll.test.d.ts +0 -6
  1025. package/dist/src/ui/hooks/useBatchedScroll.test.js +0 -62
  1026. package/dist/src/ui/hooks/useBatchedScroll.test.js.map +0 -1
  1027. package/dist/src/ui/hooks/useCommandCompletion.test.d.ts +0 -6
  1028. package/dist/src/ui/hooks/useCommandCompletion.test.js +0 -722
  1029. package/dist/src/ui/hooks/useCommandCompletion.test.js.map +0 -1
  1030. package/dist/src/ui/hooks/useConsoleMessages.test.d.ts +0 -6
  1031. package/dist/src/ui/hooks/useConsoleMessages.test.js +0 -201
  1032. package/dist/src/ui/hooks/useConsoleMessages.test.js.map +0 -1
  1033. package/dist/src/ui/hooks/useEditorSettings.test.d.ts +0 -6
  1034. package/dist/src/ui/hooks/useEditorSettings.test.js +0 -179
  1035. package/dist/src/ui/hooks/useEditorSettings.test.js.map +0 -1
  1036. package/dist/src/ui/hooks/useExecutionLifecycle.test.d.ts +0 -6
  1037. package/dist/src/ui/hooks/useExecutionLifecycle.test.js +0 -903
  1038. package/dist/src/ui/hooks/useExecutionLifecycle.test.js.map +0 -1
  1039. package/dist/src/ui/hooks/useExtensionUpdates.test.d.ts +0 -6
  1040. package/dist/src/ui/hooks/useExtensionUpdates.test.js +0 -280
  1041. package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +0 -1
  1042. package/dist/src/ui/hooks/useFlickerDetector.test.d.ts +0 -6
  1043. package/dist/src/ui/hooks/useFlickerDetector.test.js +0 -106
  1044. package/dist/src/ui/hooks/useFlickerDetector.test.js.map +0 -1
  1045. package/dist/src/ui/hooks/useFocus.test.d.ts +0 -6
  1046. package/dist/src/ui/hooks/useFocus.test.js +0 -140
  1047. package/dist/src/ui/hooks/useFocus.test.js.map +0 -1
  1048. package/dist/src/ui/hooks/useFolderTrust.test.d.ts +0 -6
  1049. package/dist/src/ui/hooks/useFolderTrust.test.js +0 -268
  1050. package/dist/src/ui/hooks/useFolderTrust.test.js.map +0 -1
  1051. package/dist/src/ui/hooks/useGeminiStream.test.d.ts +0 -6
  1052. package/dist/src/ui/hooks/useGeminiStream.test.js +0 -2855
  1053. package/dist/src/ui/hooks/useGeminiStream.test.js.map +0 -1
  1054. package/dist/src/ui/hooks/useGitBranchName.test.d.ts +0 -6
  1055. package/dist/src/ui/hooks/useGitBranchName.test.js +0 -237
  1056. package/dist/src/ui/hooks/useGitBranchName.test.js.map +0 -1
  1057. package/dist/src/ui/hooks/useHistoryManager.test.d.ts +0 -6
  1058. package/dist/src/ui/hooks/useHistoryManager.test.js +0 -259
  1059. package/dist/src/ui/hooks/useHistoryManager.test.js.map +0 -1
  1060. package/dist/src/ui/hooks/useHookDisplayState.test.d.ts +0 -6
  1061. package/dist/src/ui/hooks/useHookDisplayState.test.js +0 -200
  1062. package/dist/src/ui/hooks/useHookDisplayState.test.js.map +0 -1
  1063. package/dist/src/ui/hooks/useIdeTrustListener.test.d.ts +0 -6
  1064. package/dist/src/ui/hooks/useIdeTrustListener.test.js +0 -225
  1065. package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +0 -1
  1066. package/dist/src/ui/hooks/useIncludeDirsTrust.test.d.ts +0 -6
  1067. package/dist/src/ui/hooks/useIncludeDirsTrust.test.js +0 -174
  1068. package/dist/src/ui/hooks/useIncludeDirsTrust.test.js.map +0 -1
  1069. package/dist/src/ui/hooks/useInlineEditBuffer.test.d.ts +0 -6
  1070. package/dist/src/ui/hooks/useInlineEditBuffer.test.js +0 -112
  1071. package/dist/src/ui/hooks/useInlineEditBuffer.test.js.map +0 -1
  1072. package/dist/src/ui/hooks/useInputHistory.test.d.ts +0 -6
  1073. package/dist/src/ui/hooks/useInputHistory.test.js +0 -389
  1074. package/dist/src/ui/hooks/useInputHistory.test.js.map +0 -1
  1075. package/dist/src/ui/hooks/useInputHistoryStore.test.d.ts +0 -6
  1076. package/dist/src/ui/hooks/useInputHistoryStore.test.js +0 -238
  1077. package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +0 -1
  1078. package/dist/src/ui/hooks/useKeypress.test.d.ts +0 -6
  1079. package/dist/src/ui/hooks/useKeypress.test.js +0 -198
  1080. package/dist/src/ui/hooks/useKeypress.test.js.map +0 -1
  1081. package/dist/src/ui/hooks/useLoadingIndicator.test.d.ts +0 -6
  1082. package/dist/src/ui/hooks/useLoadingIndicator.test.js +0 -177
  1083. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +0 -1
  1084. package/dist/src/ui/hooks/useLogger.test.d.ts +0 -6
  1085. package/dist/src/ui/hooks/useLogger.test.js +0 -44
  1086. package/dist/src/ui/hooks/useLogger.test.js.map +0 -1
  1087. package/dist/src/ui/hooks/useMcpStatus.test.d.ts +0 -6
  1088. package/dist/src/ui/hooks/useMcpStatus.test.js +0 -69
  1089. package/dist/src/ui/hooks/useMcpStatus.test.js.map +0 -1
  1090. package/dist/src/ui/hooks/useMemoryMonitor.test.d.ts +0 -6
  1091. package/dist/src/ui/hooks/useMemoryMonitor.test.js +0 -62
  1092. package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +0 -1
  1093. package/dist/src/ui/hooks/useMessageQueue.test.d.ts +0 -6
  1094. package/dist/src/ui/hooks/useMessageQueue.test.js +0 -365
  1095. package/dist/src/ui/hooks/useMessageQueue.test.js.map +0 -1
  1096. package/dist/src/ui/hooks/useModelCommand.test.d.ts +0 -6
  1097. package/dist/src/ui/hooks/useModelCommand.test.js +0 -45
  1098. package/dist/src/ui/hooks/useModelCommand.test.js.map +0 -1
  1099. package/dist/src/ui/hooks/useMouse.test.d.ts +0 -6
  1100. package/dist/src/ui/hooks/useMouse.test.js +0 -52
  1101. package/dist/src/ui/hooks/useMouse.test.js.map +0 -1
  1102. package/dist/src/ui/hooks/useMouseClick.test.d.ts +0 -6
  1103. package/dist/src/ui/hooks/useMouseClick.test.js +0 -68
  1104. package/dist/src/ui/hooks/useMouseClick.test.js.map +0 -1
  1105. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.d.ts +0 -6
  1106. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js +0 -291
  1107. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js.map +0 -1
  1108. package/dist/src/ui/hooks/usePhraseCycler.test.d.ts +0 -6
  1109. package/dist/src/ui/hooks/usePhraseCycler.test.js +0 -187
  1110. package/dist/src/ui/hooks/usePhraseCycler.test.js.map +0 -1
  1111. package/dist/src/ui/hooks/usePrivacySettings.test.d.ts +0 -6
  1112. package/dist/src/ui/hooks/usePrivacySettings.test.js +0 -113
  1113. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +0 -1
  1114. package/dist/src/ui/hooks/useQuotaAndFallback.test.d.ts +0 -6
  1115. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +0 -817
  1116. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +0 -1
  1117. package/dist/src/ui/hooks/useReverseSearchCompletion.test.d.ts +0 -6
  1118. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +0 -168
  1119. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +0 -1
  1120. package/dist/src/ui/hooks/useRewind.test.d.ts +0 -6
  1121. package/dist/src/ui/hooks/useRewind.test.js +0 -100
  1122. package/dist/src/ui/hooks/useRewind.test.js.map +0 -1
  1123. package/dist/src/ui/hooks/useSelectionList.test.d.ts +0 -6
  1124. package/dist/src/ui/hooks/useSelectionList.test.js +0 -960
  1125. package/dist/src/ui/hooks/useSelectionList.test.js.map +0 -1
  1126. package/dist/src/ui/hooks/useSessionBrowser.test.d.ts +0 -6
  1127. package/dist/src/ui/hooks/useSessionBrowser.test.js +0 -277
  1128. package/dist/src/ui/hooks/useSessionBrowser.test.js.map +0 -1
  1129. package/dist/src/ui/hooks/useSessionResume.test.d.ts +0 -6
  1130. package/dist/src/ui/hooks/useSessionResume.test.js +0 -402
  1131. package/dist/src/ui/hooks/useSessionResume.test.js.map +0 -1
  1132. package/dist/src/ui/hooks/useSettingsNavigation.test.d.ts +0 -6
  1133. package/dist/src/ui/hooks/useSettingsNavigation.test.js +0 -87
  1134. package/dist/src/ui/hooks/useSettingsNavigation.test.js.map +0 -1
  1135. package/dist/src/ui/hooks/useShellCompletion.test.d.ts +0 -6
  1136. package/dist/src/ui/hooks/useShellCompletion.test.js +0 -354
  1137. package/dist/src/ui/hooks/useShellCompletion.test.js.map +0 -1
  1138. package/dist/src/ui/hooks/useShellHistory.test.d.ts +0 -6
  1139. package/dist/src/ui/hooks/useShellHistory.test.js +0 -226
  1140. package/dist/src/ui/hooks/useShellHistory.test.js.map +0 -1
  1141. package/dist/src/ui/hooks/useShellInactivityStatus.test.d.ts +0 -6
  1142. package/dist/src/ui/hooks/useShellInactivityStatus.test.js +0 -84
  1143. package/dist/src/ui/hooks/useShellInactivityStatus.test.js.map +0 -1
  1144. package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +0 -10
  1145. package/dist/src/ui/hooks/useSlashCompletion.test.js +0 -977
  1146. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +0 -1
  1147. package/dist/src/ui/hooks/useSnowfall.test.d.ts +0 -6
  1148. package/dist/src/ui/hooks/useSnowfall.test.js +0 -92
  1149. package/dist/src/ui/hooks/useSnowfall.test.js.map +0 -1
  1150. package/dist/src/ui/hooks/useSuspend.test.d.ts +0 -6
  1151. package/dist/src/ui/hooks/useSuspend.test.js +0 -136
  1152. package/dist/src/ui/hooks/useSuspend.test.js.map +0 -1
  1153. package/dist/src/ui/hooks/useTabbedNavigation.test.d.ts +0 -6
  1154. package/dist/src/ui/hooks/useTabbedNavigation.test.js +0 -243
  1155. package/dist/src/ui/hooks/useTabbedNavigation.test.js.map +0 -1
  1156. package/dist/src/ui/hooks/useTerminalTheme.test.d.ts +0 -6
  1157. package/dist/src/ui/hooks/useTerminalTheme.test.js +0 -169
  1158. package/dist/src/ui/hooks/useTerminalTheme.test.js.map +0 -1
  1159. package/dist/src/ui/hooks/useTimer.test.d.ts +0 -6
  1160. package/dist/src/ui/hooks/useTimer.test.js +0 -119
  1161. package/dist/src/ui/hooks/useTimer.test.js.map +0 -1
  1162. package/dist/src/ui/hooks/useTips.test.d.ts +0 -6
  1163. package/dist/src/ui/hooks/useTips.test.js +0 -33
  1164. package/dist/src/ui/hooks/useTips.test.js.map +0 -1
  1165. package/dist/src/ui/hooks/useToolScheduler.test.d.ts +0 -6
  1166. package/dist/src/ui/hooks/useToolScheduler.test.js +0 -534
  1167. package/dist/src/ui/hooks/useToolScheduler.test.js.map +0 -1
  1168. package/dist/src/ui/hooks/useTurnActivityMonitor.test.d.ts +0 -6
  1169. package/dist/src/ui/hooks/useTurnActivityMonitor.test.js +0 -99
  1170. package/dist/src/ui/hooks/useTurnActivityMonitor.test.js.map +0 -1
  1171. package/dist/src/ui/hooks/vim-passthrough.test.d.ts +0 -6
  1172. package/dist/src/ui/hooks/vim-passthrough.test.js +0 -84
  1173. package/dist/src/ui/hooks/vim-passthrough.test.js.map +0 -1
  1174. package/dist/src/ui/hooks/vim.test.d.ts +0 -6
  1175. package/dist/src/ui/hooks/vim.test.js +0 -2156
  1176. package/dist/src/ui/hooks/vim.test.js.map +0 -1
  1177. package/dist/src/ui/key/keyBindings.test.d.ts +0 -6
  1178. package/dist/src/ui/key/keyBindings.test.js +0 -225
  1179. package/dist/src/ui/key/keyBindings.test.js.map +0 -1
  1180. package/dist/src/ui/key/keyMatchers.test.d.ts +0 -6
  1181. package/dist/src/ui/key/keyMatchers.test.js +0 -524
  1182. package/dist/src/ui/key/keyMatchers.test.js.map +0 -1
  1183. package/dist/src/ui/key/keybindingUtils.test.d.ts +0 -6
  1184. package/dist/src/ui/key/keybindingUtils.test.js +0 -121
  1185. package/dist/src/ui/key/keybindingUtils.test.js.map +0 -1
  1186. package/dist/src/ui/layouts/DefaultAppLayout.test.d.ts +0 -6
  1187. package/dist/src/ui/layouts/DefaultAppLayout.test.js +0 -126
  1188. package/dist/src/ui/layouts/DefaultAppLayout.test.js.map +0 -1
  1189. package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.d.ts +0 -6
  1190. package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.js +0 -134
  1191. package/dist/src/ui/privacy/CloudFreePrivacyNotice.test.js.map +0 -1
  1192. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.d.ts +0 -6
  1193. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.js +0 -43
  1194. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.test.js.map +0 -1
  1195. package/dist/src/ui/privacy/GeminiPrivacyNotice.test.d.ts +0 -6
  1196. package/dist/src/ui/privacy/GeminiPrivacyNotice.test.js +0 -43
  1197. package/dist/src/ui/privacy/GeminiPrivacyNotice.test.js.map +0 -1
  1198. package/dist/src/ui/privacy/PrivacyNotice.test.d.ts +0 -6
  1199. package/dist/src/ui/privacy/PrivacyNotice.test.js +0 -63
  1200. package/dist/src/ui/privacy/PrivacyNotice.test.js.map +0 -1
  1201. package/dist/src/ui/state/extensions.test.d.ts +0 -6
  1202. package/dist/src/ui/state/extensions.test.js +0 -219
  1203. package/dist/src/ui/state/extensions.test.js.map +0 -1
  1204. package/dist/src/ui/themes/color-utils.test.d.ts +0 -6
  1205. package/dist/src/ui/themes/color-utils.test.js +0 -326
  1206. package/dist/src/ui/themes/color-utils.test.js.map +0 -1
  1207. package/dist/src/ui/themes/theme-manager.test.d.ts +0 -6
  1208. package/dist/src/ui/themes/theme-manager.test.js +0 -274
  1209. package/dist/src/ui/themes/theme-manager.test.js.map +0 -1
  1210. package/dist/src/ui/themes/theme.test.d.ts +0 -6
  1211. package/dist/src/ui/themes/theme.test.js +0 -171
  1212. package/dist/src/ui/themes/theme.test.js.map +0 -1
  1213. package/dist/src/ui/utils/CodeColorizer.test.d.ts +0 -6
  1214. package/dist/src/ui/utils/CodeColorizer.test.js +0 -74
  1215. package/dist/src/ui/utils/CodeColorizer.test.js.map +0 -1
  1216. package/dist/src/ui/utils/ConsolePatcher.test.d.ts +0 -6
  1217. package/dist/src/ui/utils/ConsolePatcher.test.js +0 -199
  1218. package/dist/src/ui/utils/ConsolePatcher.test.js.map +0 -1
  1219. package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +0 -6
  1220. package/dist/src/ui/utils/MarkdownDisplay.test.js +0 -175
  1221. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +0 -1
  1222. package/dist/src/ui/utils/TableRenderer.test.d.ts +0 -1
  1223. package/dist/src/ui/utils/TableRenderer.test.js +0 -396
  1224. package/dist/src/ui/utils/TableRenderer.test.js.map +0 -1
  1225. package/dist/src/ui/utils/antigravityUtils.test.d.ts +0 -6
  1226. package/dist/src/ui/utils/antigravityUtils.test.js +0 -54
  1227. package/dist/src/ui/utils/antigravityUtils.test.js.map +0 -1
  1228. package/dist/src/ui/utils/borderStyles.test.d.ts +0 -6
  1229. package/dist/src/ui/utils/borderStyles.test.js +0 -172
  1230. package/dist/src/ui/utils/borderStyles.test.js.map +0 -1
  1231. package/dist/src/ui/utils/clipboardUtils.test.d.ts +0 -6
  1232. package/dist/src/ui/utils/clipboardUtils.test.js +0 -442
  1233. package/dist/src/ui/utils/clipboardUtils.test.js.map +0 -1
  1234. package/dist/src/ui/utils/clipboardUtils.windows.test.d.ts +0 -6
  1235. package/dist/src/ui/utils/clipboardUtils.windows.test.js +0 -56
  1236. package/dist/src/ui/utils/clipboardUtils.windows.test.js.map +0 -1
  1237. package/dist/src/ui/utils/commandUtils.test.d.ts +0 -6
  1238. package/dist/src/ui/utils/commandUtils.test.js +0 -511
  1239. package/dist/src/ui/utils/commandUtils.test.js.map +0 -1
  1240. package/dist/src/ui/utils/computeStats.test.d.ts +0 -6
  1241. package/dist/src/ui/utils/computeStats.test.js +0 -279
  1242. package/dist/src/ui/utils/computeStats.test.js.map +0 -1
  1243. package/dist/src/ui/utils/directoryUtils.test.d.ts +0 -6
  1244. package/dist/src/ui/utils/directoryUtils.test.js +0 -239
  1245. package/dist/src/ui/utils/directoryUtils.test.js.map +0 -1
  1246. package/dist/src/ui/utils/displayUtils.test.d.ts +0 -6
  1247. package/dist/src/ui/utils/displayUtils.test.js +0 -61
  1248. package/dist/src/ui/utils/displayUtils.test.js.map +0 -1
  1249. package/dist/src/ui/utils/formatters.test.d.ts +0 -6
  1250. package/dist/src/ui/utils/formatters.test.js +0 -152
  1251. package/dist/src/ui/utils/formatters.test.js.map +0 -1
  1252. package/dist/src/ui/utils/highlight.test.d.ts +0 -6
  1253. package/dist/src/ui/utils/highlight.test.js +0 -205
  1254. package/dist/src/ui/utils/highlight.test.js.map +0 -1
  1255. package/dist/src/ui/utils/input.test.d.ts +0 -6
  1256. package/dist/src/ui/utils/input.test.js +0 -44
  1257. package/dist/src/ui/utils/input.test.js.map +0 -1
  1258. package/dist/src/ui/utils/latexToUnicode.test.d.ts +0 -6
  1259. package/dist/src/ui/utils/latexToUnicode.test.js +0 -222
  1260. package/dist/src/ui/utils/latexToUnicode.test.js.map +0 -1
  1261. package/dist/src/ui/utils/markdownParsingUtils.test.d.ts +0 -6
  1262. package/dist/src/ui/utils/markdownParsingUtils.test.js +0 -201
  1263. package/dist/src/ui/utils/markdownParsingUtils.test.js.map +0 -1
  1264. package/dist/src/ui/utils/markdownUtilities.test.d.ts +0 -6
  1265. package/dist/src/ui/utils/markdownUtilities.test.js +0 -42
  1266. package/dist/src/ui/utils/markdownUtilities.test.js.map +0 -1
  1267. package/dist/src/ui/utils/memorySnapshot.test.d.ts +0 -6
  1268. package/dist/src/ui/utils/memorySnapshot.test.js +0 -62
  1269. package/dist/src/ui/utils/memorySnapshot.test.js.map +0 -1
  1270. package/dist/src/ui/utils/mouse.test.d.ts +0 -6
  1271. package/dist/src/ui/utils/mouse.test.js +0 -136
  1272. package/dist/src/ui/utils/mouse.test.js.map +0 -1
  1273. package/dist/src/ui/utils/pendingAttentionNotification.test.d.ts +0 -6
  1274. package/dist/src/ui/utils/pendingAttentionNotification.test.js +0 -79
  1275. package/dist/src/ui/utils/pendingAttentionNotification.test.js.map +0 -1
  1276. package/dist/src/ui/utils/rewindFileOps.test.d.ts +0 -6
  1277. package/dist/src/ui/utils/rewindFileOps.test.js +0 -375
  1278. package/dist/src/ui/utils/rewindFileOps.test.js.map +0 -1
  1279. package/dist/src/ui/utils/terminalCapabilityManager.test.d.ts +0 -6
  1280. package/dist/src/ui/utils/terminalCapabilityManager.test.js +0 -400
  1281. package/dist/src/ui/utils/terminalCapabilityManager.test.js.map +0 -1
  1282. package/dist/src/ui/utils/terminalSetup.test.d.ts +0 -6
  1283. package/dist/src/ui/utils/terminalSetup.test.js +0 -201
  1284. package/dist/src/ui/utils/terminalSetup.test.js.map +0 -1
  1285. package/dist/src/ui/utils/textOutput.test.d.ts +0 -6
  1286. package/dist/src/ui/utils/textOutput.test.js +0 -80
  1287. package/dist/src/ui/utils/textOutput.test.js.map +0 -1
  1288. package/dist/src/ui/utils/textUtils.test.d.ts +0 -6
  1289. package/dist/src/ui/utils/textUtils.test.js +0 -430
  1290. package/dist/src/ui/utils/textUtils.test.js.map +0 -1
  1291. package/dist/src/ui/utils/toolLayoutUtils.test.d.ts +0 -6
  1292. package/dist/src/ui/utils/toolLayoutUtils.test.js +0 -187
  1293. package/dist/src/ui/utils/toolLayoutUtils.test.js.map +0 -1
  1294. package/dist/src/ui/utils/ui-sizing.test.d.ts +0 -6
  1295. package/dist/src/ui/utils/ui-sizing.test.js +0 -25
  1296. package/dist/src/ui/utils/ui-sizing.test.js.map +0 -1
  1297. package/dist/src/ui/utils/updateCheck.test.d.ts +0 -6
  1298. package/dist/src/ui/utils/updateCheck.test.js +0 -207
  1299. package/dist/src/ui/utils/updateCheck.test.js.map +0 -1
  1300. package/dist/src/ui/utils/urlSecurityUtils.test.d.ts +0 -6
  1301. package/dist/src/ui/utils/urlSecurityUtils.test.js +0 -49
  1302. package/dist/src/ui/utils/urlSecurityUtils.test.js.map +0 -1
  1303. package/dist/src/utils/activityLogger.test.d.ts +0 -6
  1304. package/dist/src/utils/activityLogger.test.js +0 -196
  1305. package/dist/src/utils/activityLogger.test.js.map +0 -1
  1306. package/dist/src/utils/agentSettings.test.d.ts +0 -6
  1307. package/dist/src/utils/agentSettings.test.js +0 -111
  1308. package/dist/src/utils/agentSettings.test.js.map +0 -1
  1309. package/dist/src/utils/agentUtils.test.d.ts +0 -6
  1310. package/dist/src/utils/agentUtils.test.js +0 -121
  1311. package/dist/src/utils/agentUtils.test.js.map +0 -1
  1312. package/dist/src/utils/cleanup.test.d.ts +0 -6
  1313. package/dist/src/utils/cleanup.test.js +0 -256
  1314. package/dist/src/utils/cleanup.test.js.map +0 -1
  1315. package/dist/src/utils/commands.test.d.ts +0 -6
  1316. package/dist/src/utils/commands.test.js +0 -194
  1317. package/dist/src/utils/commands.test.js.map +0 -1
  1318. package/dist/src/utils/commentJson.test.d.ts +0 -6
  1319. package/dist/src/utils/commentJson.test.js +0 -308
  1320. package/dist/src/utils/commentJson.test.js.map +0 -1
  1321. package/dist/src/utils/deepMerge.test.d.ts +0 -6
  1322. package/dist/src/utils/deepMerge.test.js +0 -211
  1323. package/dist/src/utils/deepMerge.test.js.map +0 -1
  1324. package/dist/src/utils/devtoolsService.test.d.ts +0 -6
  1325. package/dist/src/utils/devtoolsService.test.js +0 -346
  1326. package/dist/src/utils/devtoolsService.test.js.map +0 -1
  1327. package/dist/src/utils/dialogScopeUtils.test.d.ts +0 -6
  1328. package/dist/src/utils/dialogScopeUtils.test.js +0 -81
  1329. package/dist/src/utils/dialogScopeUtils.test.js.map +0 -1
  1330. package/dist/src/utils/envVarResolver.test.d.ts +0 -6
  1331. package/dist/src/utils/envVarResolver.test.js +0 -238
  1332. package/dist/src/utils/envVarResolver.test.js.map +0 -1
  1333. package/dist/src/utils/errors.test.d.ts +0 -6
  1334. package/dist/src/utils/errors.test.js +0 -420
  1335. package/dist/src/utils/errors.test.js.map +0 -1
  1336. package/dist/src/utils/events.test.d.ts +0 -6
  1337. package/dist/src/utils/events.test.js +0 -24
  1338. package/dist/src/utils/events.test.js.map +0 -1
  1339. package/dist/src/utils/featureToggleUtils.test.d.ts +0 -6
  1340. package/dist/src/utils/featureToggleUtils.test.js +0 -126
  1341. package/dist/src/utils/featureToggleUtils.test.js.map +0 -1
  1342. package/dist/src/utils/gitUtils.test.d.ts +0 -6
  1343. package/dist/src/utils/gitUtils.test.js +0 -172
  1344. package/dist/src/utils/gitUtils.test.js.map +0 -1
  1345. package/dist/src/utils/handleAutoUpdate.test.d.ts +0 -6
  1346. package/dist/src/utils/handleAutoUpdate.test.js +0 -399
  1347. package/dist/src/utils/handleAutoUpdate.test.js.map +0 -1
  1348. package/dist/src/utils/hookSettings.test.d.ts +0 -6
  1349. package/dist/src/utils/hookSettings.test.js +0 -117
  1350. package/dist/src/utils/hookSettings.test.js.map +0 -1
  1351. package/dist/src/utils/hookUtils.test.d.ts +0 -6
  1352. package/dist/src/utils/hookUtils.test.js +0 -113
  1353. package/dist/src/utils/hookUtils.test.js.map +0 -1
  1354. package/dist/src/utils/installationInfo.test.d.ts +0 -6
  1355. package/dist/src/utils/installationInfo.test.js +0 -322
  1356. package/dist/src/utils/installationInfo.test.js.map +0 -1
  1357. package/dist/src/utils/jsonoutput.test.d.ts +0 -6
  1358. package/dist/src/utils/jsonoutput.test.js +0 -74
  1359. package/dist/src/utils/jsonoutput.test.js.map +0 -1
  1360. package/dist/src/utils/logCleanup.test.d.ts +0 -6
  1361. package/dist/src/utils/logCleanup.test.js +0 -87
  1362. package/dist/src/utils/logCleanup.test.js.map +0 -1
  1363. package/dist/src/utils/math.test.d.ts +0 -6
  1364. package/dist/src/utils/math.test.js +0 -23
  1365. package/dist/src/utils/math.test.js.map +0 -1
  1366. package/dist/src/utils/persistentState.test.d.ts +0 -6
  1367. package/dist/src/utils/persistentState.test.js +0 -68
  1368. package/dist/src/utils/persistentState.test.js.map +0 -1
  1369. package/dist/src/utils/processUtils.test.d.ts +0 -6
  1370. package/dist/src/utils/processUtils.test.js +0 -150
  1371. package/dist/src/utils/processUtils.test.js.map +0 -1
  1372. package/dist/src/utils/readStdin.test.d.ts +0 -6
  1373. package/dist/src/utils/readStdin.test.js +0 -149
  1374. package/dist/src/utils/readStdin.test.js.map +0 -1
  1375. package/dist/src/utils/readStdin_safety.test.d.ts +0 -6
  1376. package/dist/src/utils/readStdin_safety.test.js +0 -68
  1377. package/dist/src/utils/readStdin_safety.test.js.map +0 -1
  1378. package/dist/src/utils/relaunch.test.d.ts +0 -6
  1379. package/dist/src/utils/relaunch.test.js +0 -275
  1380. package/dist/src/utils/relaunch.test.js.map +0 -1
  1381. package/dist/src/utils/resolvePath.test.d.ts +0 -6
  1382. package/dist/src/utils/resolvePath.test.js +0 -34
  1383. package/dist/src/utils/resolvePath.test.js.map +0 -1
  1384. package/dist/src/utils/sandbox.test.d.ts +0 -6
  1385. package/dist/src/utils/sandbox.test.js +0 -725
  1386. package/dist/src/utils/sandbox.test.js.map +0 -1
  1387. package/dist/src/utils/sandboxUtils.test.d.ts +0 -6
  1388. package/dist/src/utils/sandboxUtils.test.js +0 -190
  1389. package/dist/src/utils/sandboxUtils.test.js.map +0 -1
  1390. package/dist/src/utils/sessionCleanup.integration.test.d.ts +0 -6
  1391. package/dist/src/utils/sessionCleanup.integration.test.js +0 -276
  1392. package/dist/src/utils/sessionCleanup.integration.test.js.map +0 -1
  1393. package/dist/src/utils/sessionCleanup.test.d.ts +0 -6
  1394. package/dist/src/utils/sessionCleanup.test.js +0 -829
  1395. package/dist/src/utils/sessionCleanup.test.js.map +0 -1
  1396. package/dist/src/utils/sessionUtils.test.d.ts +0 -6
  1397. package/dist/src/utils/sessionUtils.test.js +0 -815
  1398. package/dist/src/utils/sessionUtils.test.js.map +0 -1
  1399. package/dist/src/utils/sessions.test.d.ts +0 -6
  1400. package/dist/src/utils/sessions.test.js +0 -580
  1401. package/dist/src/utils/sessions.test.js.map +0 -1
  1402. package/dist/src/utils/settingsUtils.test.d.ts +0 -6
  1403. package/dist/src/utils/settingsUtils.test.js +0 -673
  1404. package/dist/src/utils/settingsUtils.test.js.map +0 -1
  1405. package/dist/src/utils/skillSettings.test.d.ts +0 -6
  1406. package/dist/src/utils/skillSettings.test.js +0 -142
  1407. package/dist/src/utils/skillSettings.test.js.map +0 -1
  1408. package/dist/src/utils/skillUtils.test.d.ts +0 -6
  1409. package/dist/src/utils/skillUtils.test.js +0 -248
  1410. package/dist/src/utils/skillUtils.test.js.map +0 -1
  1411. package/dist/src/utils/startupWarnings.test.d.ts +0 -6
  1412. package/dist/src/utils/startupWarnings.test.js +0 -61
  1413. package/dist/src/utils/startupWarnings.test.js.map +0 -1
  1414. package/dist/src/utils/terminalNotifications.test.d.ts +0 -6
  1415. package/dist/src/utils/terminalNotifications.test.js +0 -219
  1416. package/dist/src/utils/terminalNotifications.test.js.map +0 -1
  1417. package/dist/src/utils/terminalTheme.test.d.ts +0 -6
  1418. package/dist/src/utils/terminalTheme.test.js +0 -91
  1419. package/dist/src/utils/terminalTheme.test.js.map +0 -1
  1420. package/dist/src/utils/tierUtils.test.d.ts +0 -6
  1421. package/dist/src/utils/tierUtils.test.js +0 -25
  1422. package/dist/src/utils/tierUtils.test.js.map +0 -1
  1423. package/dist/src/utils/toolOutputCleanup.test.d.ts +0 -6
  1424. package/dist/src/utils/toolOutputCleanup.test.js +0 -280
  1425. package/dist/src/utils/toolOutputCleanup.test.js.map +0 -1
  1426. package/dist/src/utils/updateEventEmitter.test.d.ts +0 -6
  1427. package/dist/src/utils/updateEventEmitter.test.js +0 -18
  1428. package/dist/src/utils/updateEventEmitter.test.js.map +0 -1
  1429. package/dist/src/utils/userStartupWarnings.test.d.ts +0 -6
  1430. package/dist/src/utils/userStartupWarnings.test.js +0 -225
  1431. package/dist/src/utils/userStartupWarnings.test.js.map +0 -1
  1432. package/dist/src/utils/windowTitle.test.d.ts +0 -6
  1433. package/dist/src/utils/windowTitle.test.js +0 -216
  1434. package/dist/src/utils/windowTitle.test.js.map +0 -1
  1435. package/dist/src/utils/worktreeSetup.test.d.ts +0 -6
  1436. package/dist/src/utils/worktreeSetup.test.js +0 -89
  1437. package/dist/src/utils/worktreeSetup.test.js.map +0 -1
  1438. package/dist/src/validateNonInterActiveAuth.test.d.ts +0 -6
  1439. package/dist/src/validateNonInterActiveAuth.test.js +0 -319
  1440. package/dist/src/validateNonInterActiveAuth.test.js.map +0 -1
@@ -1,2965 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
7
- import stripAnsi from 'strip-ansi';
8
- import { act } from 'react';
9
- import * as fs from 'node:fs';
10
- import * as path from 'node:path';
11
- import * as os from 'node:os';
12
- import { renderHook, renderHookWithProviders, } from '../../../test-utils/render.js';
13
- import { useTextBuffer, offsetToLogicalPos, logicalPosToOffset, textBufferReducer, findWordEndInLine, findNextWordStartInLine, findNextBigWordStartInLine, findPrevBigWordStartInLine, findBigWordEndInLine, isWordCharStrict, calculateTransformationsForLine, calculateTransformedLine, getTransformUnderCursor, getTransformedImagePath, } from './text-buffer.js';
14
- import { cpLen } from '../../utils/textUtils.js';
15
- import {} from '../../hooks/useKeypress.js';
16
- import { escapePath } from '@google/gemini-cli-core';
17
- vi.mock('../../contexts/SettingsContext.js', async (importOriginal) => {
18
- const actual = await importOriginal();
19
- return {
20
- ...actual,
21
- useSettings: () => ({
22
- merged: { general: { openEditorInNewWindow: false } },
23
- }),
24
- };
25
- });
26
- const defaultVisualLayout = {
27
- visualLines: [''],
28
- logicalToVisualMap: [[[0, 0]]],
29
- visualToLogicalMap: [[0, 0]],
30
- transformedToLogicalMaps: [[]],
31
- visualToTransformedMap: [],
32
- };
33
- const initialState = {
34
- lines: [''],
35
- cursorRow: 0,
36
- cursorCol: 0,
37
- preferredCol: null,
38
- undoStack: [],
39
- redoStack: [],
40
- clipboard: null,
41
- selectionAnchor: null,
42
- viewportWidth: 80,
43
- viewportHeight: 24,
44
- transformationsByLine: [[]],
45
- visualLayout: defaultVisualLayout,
46
- pastedContent: {},
47
- expandedPaste: null,
48
- yankRegister: null,
49
- };
50
- /**
51
- * Helper to create a TextBufferState with properly calculated transformations.
52
- */
53
- function createStateWithTransformations(partial) {
54
- const state = { ...initialState, ...partial };
55
- return {
56
- ...state,
57
- transformationsByLine: state.lines.map((l) => calculateTransformationsForLine(l)),
58
- };
59
- }
60
- describe('textBufferReducer', () => {
61
- afterEach(() => {
62
- vi.restoreAllMocks();
63
- });
64
- it('should return the initial state if state is undefined', async () => {
65
- const action = { type: 'unknown_action' };
66
- const state = textBufferReducer(initialState, action);
67
- expect(state).toHaveOnlyValidCharacters();
68
- expect(state).toEqual(initialState);
69
- });
70
- describe('Big Word Navigation Helpers', () => {
71
- describe('findNextBigWordStartInLine (W)', () => {
72
- it('should skip non-whitespace and then whitespace', async () => {
73
- expect(findNextBigWordStartInLine('hello world', 0)).toBe(6);
74
- expect(findNextBigWordStartInLine('hello.world test', 0)).toBe(12);
75
- expect(findNextBigWordStartInLine(' test', 0)).toBe(3);
76
- expect(findNextBigWordStartInLine('test ', 0)).toBe(null);
77
- });
78
- });
79
- describe('findPrevBigWordStartInLine (B)', () => {
80
- it('should skip whitespace backwards then non-whitespace', async () => {
81
- expect(findPrevBigWordStartInLine('hello world', 6)).toBe(0);
82
- expect(findPrevBigWordStartInLine('hello.world test', 12)).toBe(0);
83
- expect(findPrevBigWordStartInLine(' test', 3)).toBe(null); // At start of word
84
- expect(findPrevBigWordStartInLine(' test', 4)).toBe(3); // Inside word
85
- expect(findPrevBigWordStartInLine('test ', 6)).toBe(0);
86
- });
87
- });
88
- describe('findBigWordEndInLine (E)', () => {
89
- it('should find end of current big word', async () => {
90
- expect(findBigWordEndInLine('hello world', 0)).toBe(4);
91
- expect(findBigWordEndInLine('hello.world test', 0)).toBe(10);
92
- expect(findBigWordEndInLine('hello.world test', 11)).toBe(15);
93
- });
94
- it('should skip whitespace if currently on whitespace', async () => {
95
- expect(findBigWordEndInLine('hello world', 5)).toBe(12);
96
- });
97
- it('should find next big word end if at end of current', async () => {
98
- expect(findBigWordEndInLine('hello world', 4)).toBe(10);
99
- });
100
- });
101
- });
102
- describe('set_text action', () => {
103
- it('should set new text and move cursor to the end', async () => {
104
- const action = {
105
- type: 'set_text',
106
- payload: 'hello\nworld',
107
- };
108
- const state = textBufferReducer(initialState, action);
109
- expect(state).toHaveOnlyValidCharacters();
110
- expect(state.lines).toEqual(['hello', 'world']);
111
- expect(state.cursorRow).toBe(1);
112
- expect(state.cursorCol).toBe(5);
113
- expect(state.undoStack.length).toBe(1);
114
- });
115
- it('should not create an undo snapshot if pushToUndo is false', async () => {
116
- const action = {
117
- type: 'set_text',
118
- payload: 'no undo',
119
- pushToUndo: false,
120
- };
121
- const state = textBufferReducer(initialState, action);
122
- expect(state).toHaveOnlyValidCharacters();
123
- expect(state.lines).toEqual(['no undo']);
124
- expect(state.undoStack.length).toBe(0);
125
- });
126
- });
127
- describe('insert action', () => {
128
- it('should insert a character', async () => {
129
- const action = { type: 'insert', payload: 'a' };
130
- const state = textBufferReducer(initialState, action);
131
- expect(state).toHaveOnlyValidCharacters();
132
- expect(state.lines).toEqual(['a']);
133
- expect(state.cursorCol).toBe(1);
134
- });
135
- it('should insert a newline', async () => {
136
- const stateWithText = { ...initialState, lines: ['hello'] };
137
- const action = { type: 'insert', payload: '\n' };
138
- const state = textBufferReducer(stateWithText, action);
139
- expect(state).toHaveOnlyValidCharacters();
140
- expect(state.lines).toEqual(['', 'hello']);
141
- expect(state.cursorRow).toBe(1);
142
- expect(state.cursorCol).toBe(0);
143
- });
144
- });
145
- describe('insert action with options', () => {
146
- it('should filter input using inputFilter option', async () => {
147
- const action = { type: 'insert', payload: 'a1b2c3' };
148
- const options = {
149
- inputFilter: (text) => text.replace(/[0-9]/g, ''),
150
- };
151
- const state = textBufferReducer(initialState, action, options);
152
- expect(state.lines).toEqual(['abc']);
153
- expect(state.cursorCol).toBe(3);
154
- });
155
- it('should strip newlines when singleLine option is true', async () => {
156
- const action = {
157
- type: 'insert',
158
- payload: 'hello\nworld',
159
- };
160
- const options = { singleLine: true };
161
- const state = textBufferReducer(initialState, action, options);
162
- expect(state.lines).toEqual(['helloworld']);
163
- expect(state.cursorCol).toBe(10);
164
- });
165
- it('should apply both inputFilter and singleLine options', async () => {
166
- const action = {
167
- type: 'insert',
168
- payload: 'h\ne\nl\nl\no\n1\n2\n3',
169
- };
170
- const options = {
171
- singleLine: true,
172
- inputFilter: (text) => text.replace(/[0-9]/g, ''),
173
- };
174
- const state = textBufferReducer(initialState, action, options);
175
- expect(state.lines).toEqual(['hello']);
176
- expect(state.cursorCol).toBe(5);
177
- });
178
- });
179
- describe('add_pasted_content action', () => {
180
- it('should add content to pastedContent Record', async () => {
181
- const action = {
182
- type: 'add_pasted_content',
183
- payload: { id: '[Pasted Text: 6 lines]', text: 'large content' },
184
- };
185
- const state = textBufferReducer(initialState, action);
186
- expect(state.pastedContent).toEqual({
187
- '[Pasted Text: 6 lines]': 'large content',
188
- });
189
- });
190
- });
191
- describe('backspace action', () => {
192
- it('should remove a character', async () => {
193
- const stateWithText = {
194
- ...initialState,
195
- lines: ['a'],
196
- cursorRow: 0,
197
- cursorCol: 1,
198
- };
199
- const action = { type: 'backspace' };
200
- const state = textBufferReducer(stateWithText, action);
201
- expect(state).toHaveOnlyValidCharacters();
202
- expect(state.lines).toEqual(['']);
203
- expect(state.cursorCol).toBe(0);
204
- });
205
- it('should join lines if at the beginning of a line', async () => {
206
- const stateWithText = {
207
- ...initialState,
208
- lines: ['hello', 'world'],
209
- cursorRow: 1,
210
- cursorCol: 0,
211
- };
212
- const action = { type: 'backspace' };
213
- const state = textBufferReducer(stateWithText, action);
214
- expect(state).toHaveOnlyValidCharacters();
215
- expect(state.lines).toEqual(['helloworld']);
216
- expect(state.cursorRow).toBe(0);
217
- expect(state.cursorCol).toBe(5);
218
- });
219
- });
220
- describe('atomic placeholder deletion', () => {
221
- describe('paste placeholders', () => {
222
- it('backspace at end of paste placeholder removes entire placeholder', async () => {
223
- const placeholder = '[Pasted Text: 6 lines]';
224
- const stateWithPlaceholder = createStateWithTransformations({
225
- lines: [placeholder],
226
- cursorRow: 0,
227
- cursorCol: placeholder.length, // cursor at end
228
- pastedContent: {
229
- [placeholder]: 'line1\nline2\nline3\nline4\nline5\nline6',
230
- },
231
- });
232
- const action = { type: 'backspace' };
233
- const state = textBufferReducer(stateWithPlaceholder, action);
234
- expect(state).toHaveOnlyValidCharacters();
235
- expect(state.lines).toEqual(['']);
236
- expect(state.cursorCol).toBe(0);
237
- // pastedContent should be cleaned up
238
- expect(state.pastedContent[placeholder]).toBeUndefined();
239
- });
240
- it('delete at start of paste placeholder removes entire placeholder', async () => {
241
- const placeholder = '[Pasted Text: 6 lines]';
242
- const stateWithPlaceholder = createStateWithTransformations({
243
- lines: [placeholder],
244
- cursorRow: 0,
245
- cursorCol: 0, // cursor at start
246
- pastedContent: {
247
- [placeholder]: 'line1\nline2\nline3\nline4\nline5\nline6',
248
- },
249
- });
250
- const action = { type: 'delete' };
251
- const state = textBufferReducer(stateWithPlaceholder, action);
252
- expect(state).toHaveOnlyValidCharacters();
253
- expect(state.lines).toEqual(['']);
254
- expect(state.cursorCol).toBe(0);
255
- // pastedContent should be cleaned up
256
- expect(state.pastedContent[placeholder]).toBeUndefined();
257
- });
258
- it('backspace inside paste placeholder does normal deletion', async () => {
259
- const placeholder = '[Pasted Text: 6 lines]';
260
- const stateWithPlaceholder = createStateWithTransformations({
261
- lines: [placeholder],
262
- cursorRow: 0,
263
- cursorCol: 10, // cursor in middle
264
- pastedContent: {
265
- [placeholder]: 'line1\nline2\nline3\nline4\nline5\nline6',
266
- },
267
- });
268
- const action = { type: 'backspace' };
269
- const state = textBufferReducer(stateWithPlaceholder, action);
270
- expect(state).toHaveOnlyValidCharacters();
271
- // Should only delete one character
272
- expect(state.lines[0].length).toBe(placeholder.length - 1);
273
- expect(state.cursorCol).toBe(9);
274
- // pastedContent should NOT be cleaned up (placeholder is broken)
275
- expect(state.pastedContent[placeholder]).toBeDefined();
276
- });
277
- });
278
- describe('image placeholders', () => {
279
- it('backspace at end of image path removes entire path', async () => {
280
- const imagePath = '@test.png';
281
- const stateWithImage = createStateWithTransformations({
282
- lines: [imagePath],
283
- cursorRow: 0,
284
- cursorCol: imagePath.length, // cursor at end
285
- });
286
- const action = { type: 'backspace' };
287
- const state = textBufferReducer(stateWithImage, action);
288
- expect(state).toHaveOnlyValidCharacters();
289
- expect(state.lines).toEqual(['']);
290
- expect(state.cursorCol).toBe(0);
291
- });
292
- it('delete at start of image path removes entire path', async () => {
293
- const imagePath = '@test.png';
294
- const stateWithImage = createStateWithTransformations({
295
- lines: [imagePath],
296
- cursorRow: 0,
297
- cursorCol: 0, // cursor at start
298
- });
299
- const action = { type: 'delete' };
300
- const state = textBufferReducer(stateWithImage, action);
301
- expect(state).toHaveOnlyValidCharacters();
302
- expect(state.lines).toEqual(['']);
303
- expect(state.cursorCol).toBe(0);
304
- });
305
- it('backspace inside image path does normal deletion', async () => {
306
- const imagePath = '@test.png';
307
- const stateWithImage = createStateWithTransformations({
308
- lines: [imagePath],
309
- cursorRow: 0,
310
- cursorCol: 5, // cursor in middle
311
- });
312
- const action = { type: 'backspace' };
313
- const state = textBufferReducer(stateWithImage, action);
314
- expect(state).toHaveOnlyValidCharacters();
315
- // Should only delete one character
316
- expect(state.lines[0].length).toBe(imagePath.length - 1);
317
- expect(state.cursorCol).toBe(4);
318
- });
319
- });
320
- describe('undo behavior', () => {
321
- it('undo after placeholder deletion restores everything', async () => {
322
- const placeholder = '[Pasted Text: 6 lines]';
323
- const pasteContent = 'line1\nline2\nline3\nline4\nline5\nline6';
324
- const stateWithPlaceholder = createStateWithTransformations({
325
- lines: [placeholder],
326
- cursorRow: 0,
327
- cursorCol: placeholder.length,
328
- pastedContent: { [placeholder]: pasteContent },
329
- });
330
- // Delete the placeholder
331
- const deleteAction = { type: 'backspace' };
332
- const stateAfterDelete = textBufferReducer(stateWithPlaceholder, deleteAction);
333
- expect(stateAfterDelete.lines).toEqual(['']);
334
- expect(stateAfterDelete.pastedContent[placeholder]).toBeUndefined();
335
- // Undo should restore
336
- const undoAction = { type: 'undo' };
337
- const stateAfterUndo = textBufferReducer(stateAfterDelete, undoAction);
338
- expect(stateAfterUndo).toHaveOnlyValidCharacters();
339
- expect(stateAfterUndo.lines).toEqual([placeholder]);
340
- expect(stateAfterUndo.pastedContent[placeholder]).toBe(pasteContent);
341
- });
342
- });
343
- });
344
- describe('undo/redo actions', () => {
345
- it('should undo and redo a change', async () => {
346
- // 1. Insert text
347
- const insertAction = {
348
- type: 'insert',
349
- payload: 'test',
350
- };
351
- const stateAfterInsert = textBufferReducer(initialState, insertAction);
352
- expect(stateAfterInsert).toHaveOnlyValidCharacters();
353
- expect(stateAfterInsert.lines).toEqual(['test']);
354
- expect(stateAfterInsert.undoStack.length).toBe(1);
355
- // 2. Undo
356
- const undoAction = { type: 'undo' };
357
- const stateAfterUndo = textBufferReducer(stateAfterInsert, undoAction);
358
- expect(stateAfterUndo).toHaveOnlyValidCharacters();
359
- expect(stateAfterUndo.lines).toEqual(['']);
360
- expect(stateAfterUndo.undoStack.length).toBe(0);
361
- expect(stateAfterUndo.redoStack.length).toBe(1);
362
- // 3. Redo
363
- const redoAction = { type: 'redo' };
364
- const stateAfterRedo = textBufferReducer(stateAfterUndo, redoAction);
365
- expect(stateAfterRedo).toHaveOnlyValidCharacters();
366
- expect(stateAfterRedo.lines).toEqual(['test']);
367
- expect(stateAfterRedo.undoStack.length).toBe(1);
368
- expect(stateAfterRedo.redoStack.length).toBe(0);
369
- });
370
- });
371
- describe('create_undo_snapshot action', () => {
372
- it('should create a snapshot without changing state', async () => {
373
- const stateWithText = {
374
- ...initialState,
375
- lines: ['hello'],
376
- cursorRow: 0,
377
- cursorCol: 5,
378
- };
379
- const action = { type: 'create_undo_snapshot' };
380
- const state = textBufferReducer(stateWithText, action);
381
- expect(state).toHaveOnlyValidCharacters();
382
- expect(state.lines).toEqual(['hello']);
383
- expect(state.cursorRow).toBe(0);
384
- expect(state.cursorCol).toBe(5);
385
- expect(state.undoStack.length).toBe(1);
386
- expect(state.undoStack[0].lines).toEqual(['hello']);
387
- expect(state.undoStack[0].cursorRow).toBe(0);
388
- expect(state.undoStack[0].cursorCol).toBe(5);
389
- });
390
- });
391
- describe('delete_word_left action', () => {
392
- const createSingleLineState = (text, col) => ({
393
- ...initialState,
394
- lines: [text],
395
- cursorRow: 0,
396
- cursorCol: col,
397
- });
398
- it.each([
399
- {
400
- input: 'hello world',
401
- cursorCol: 11,
402
- expectedLines: ['hello '],
403
- expectedCol: 6,
404
- desc: 'simple word',
405
- },
406
- {
407
- input: 'path/to/file',
408
- cursorCol: 12,
409
- expectedLines: ['path/to/'],
410
- expectedCol: 8,
411
- desc: 'path segment',
412
- },
413
- {
414
- input: 'variable_name',
415
- cursorCol: 13,
416
- expectedLines: ['variable_'],
417
- expectedCol: 9,
418
- desc: 'variable_name parts',
419
- },
420
- ])('should delete $desc', ({ input, cursorCol, expectedLines, expectedCol }) => {
421
- const state = textBufferReducer(createSingleLineState(input, cursorCol), { type: 'delete_word_left' });
422
- expect(state.lines).toEqual(expectedLines);
423
- expect(state.cursorCol).toBe(expectedCol);
424
- });
425
- it('should act like backspace at the beginning of a line', async () => {
426
- const stateWithText = {
427
- ...initialState,
428
- lines: ['hello', 'world'],
429
- cursorRow: 1,
430
- cursorCol: 0,
431
- };
432
- const state = textBufferReducer(stateWithText, {
433
- type: 'delete_word_left',
434
- });
435
- expect(state.lines).toEqual(['helloworld']);
436
- expect(state.cursorRow).toBe(0);
437
- expect(state.cursorCol).toBe(5);
438
- });
439
- });
440
- describe('delete_word_right action', () => {
441
- const createSingleLineState = (text, col) => ({
442
- ...initialState,
443
- lines: [text],
444
- cursorRow: 0,
445
- cursorCol: col,
446
- });
447
- it.each([
448
- {
449
- input: 'hello world',
450
- cursorCol: 0,
451
- expectedLines: ['world'],
452
- expectedCol: 0,
453
- desc: 'simple word',
454
- },
455
- {
456
- input: 'variable_name',
457
- cursorCol: 0,
458
- expectedLines: ['_name'],
459
- expectedCol: 0,
460
- desc: 'variable_name parts',
461
- },
462
- ])('should delete $desc', ({ input, cursorCol, expectedLines, expectedCol }) => {
463
- const state = textBufferReducer(createSingleLineState(input, cursorCol), { type: 'delete_word_right' });
464
- expect(state.lines).toEqual(expectedLines);
465
- expect(state.cursorCol).toBe(expectedCol);
466
- });
467
- it('should delete path segments progressively', async () => {
468
- const stateWithText = {
469
- ...initialState,
470
- lines: ['path/to/file'],
471
- cursorRow: 0,
472
- cursorCol: 0,
473
- };
474
- let state = textBufferReducer(stateWithText, {
475
- type: 'delete_word_right',
476
- });
477
- expect(state.lines).toEqual(['/to/file']);
478
- state = textBufferReducer(state, { type: 'delete_word_right' });
479
- expect(state.lines).toEqual(['to/file']);
480
- });
481
- it('should act like delete at the end of a line', async () => {
482
- const stateWithText = {
483
- ...initialState,
484
- lines: ['hello', 'world'],
485
- cursorRow: 0,
486
- cursorCol: 5,
487
- };
488
- const state = textBufferReducer(stateWithText, {
489
- type: 'delete_word_right',
490
- });
491
- expect(state.lines).toEqual(['helloworld']);
492
- expect(state.cursorRow).toBe(0);
493
- expect(state.cursorCol).toBe(5);
494
- });
495
- });
496
- describe('kill_line_left action', () => {
497
- it('should clean up pastedContent when deleting a placeholder line-left', async () => {
498
- const placeholder = '[Pasted Text: 6 lines]';
499
- const stateWithPlaceholder = createStateWithTransformations({
500
- lines: [placeholder],
501
- cursorRow: 0,
502
- cursorCol: cpLen(placeholder),
503
- pastedContent: {
504
- [placeholder]: 'line1\nline2\nline3\nline4\nline5\nline6',
505
- },
506
- });
507
- const state = textBufferReducer(stateWithPlaceholder, {
508
- type: 'kill_line_left',
509
- });
510
- expect(state.lines).toEqual(['']);
511
- expect(state.cursorCol).toBe(0);
512
- expect(Object.keys(state.pastedContent)).toHaveLength(0);
513
- });
514
- });
515
- describe('kill_line_right action', () => {
516
- it('should reset preferredCol when deleting to end of line', async () => {
517
- const stateWithText = {
518
- ...initialState,
519
- lines: ['hello world'],
520
- cursorRow: 0,
521
- cursorCol: 5,
522
- preferredCol: 9,
523
- };
524
- const state = textBufferReducer(stateWithText, {
525
- type: 'kill_line_right',
526
- });
527
- expect(state.lines).toEqual(['hello']);
528
- expect(state.preferredCol).toBe(null);
529
- });
530
- });
531
- describe('toggle_paste_expansion action', () => {
532
- const placeholder = '[Pasted Text: 6 lines]';
533
- const content = 'line1\nline2\nline3\nline4\nline5\nline6';
534
- it('should expand a placeholder correctly', async () => {
535
- const stateWithPlaceholder = createStateWithTransformations({
536
- lines: ['prefix ' + placeholder + ' suffix'],
537
- cursorRow: 0,
538
- cursorCol: 0,
539
- pastedContent: { [placeholder]: content },
540
- });
541
- const action = {
542
- type: 'toggle_paste_expansion',
543
- payload: { id: placeholder, row: 0, col: 7 },
544
- };
545
- const state = textBufferReducer(stateWithPlaceholder, action);
546
- expect(state.lines).toEqual([
547
- 'prefix line1',
548
- 'line2',
549
- 'line3',
550
- 'line4',
551
- 'line5',
552
- 'line6 suffix',
553
- ]);
554
- expect(state.expandedPaste?.id).toBe(placeholder);
555
- const info = state.expandedPaste;
556
- expect(info).toEqual({
557
- id: placeholder,
558
- startLine: 0,
559
- lineCount: 6,
560
- prefix: 'prefix ',
561
- suffix: ' suffix',
562
- });
563
- // Cursor should be at the end of expanded content (before suffix)
564
- expect(state.cursorRow).toBe(5);
565
- expect(state.cursorCol).toBe(5); // length of 'line6'
566
- });
567
- it('should collapse an expanded placeholder correctly', async () => {
568
- const expandedState = createStateWithTransformations({
569
- lines: [
570
- 'prefix line1',
571
- 'line2',
572
- 'line3',
573
- 'line4',
574
- 'line5',
575
- 'line6 suffix',
576
- ],
577
- cursorRow: 5,
578
- cursorCol: 5,
579
- pastedContent: { [placeholder]: content },
580
- expandedPaste: {
581
- id: placeholder,
582
- startLine: 0,
583
- lineCount: 6,
584
- prefix: 'prefix ',
585
- suffix: ' suffix',
586
- },
587
- });
588
- const action = {
589
- type: 'toggle_paste_expansion',
590
- payload: { id: placeholder, row: 0, col: 7 },
591
- };
592
- const state = textBufferReducer(expandedState, action);
593
- expect(state.lines).toEqual(['prefix ' + placeholder + ' suffix']);
594
- expect(state.expandedPaste).toBeNull();
595
- // Cursor should be at the end of the collapsed placeholder
596
- expect(state.cursorRow).toBe(0);
597
- expect(state.cursorCol).toBe(('prefix ' + placeholder).length);
598
- });
599
- it('should expand single-line content correctly', async () => {
600
- const singleLinePlaceholder = '[Pasted Text: 10 chars]';
601
- const singleLineContent = 'some text';
602
- const stateWithPlaceholder = createStateWithTransformations({
603
- lines: [singleLinePlaceholder],
604
- cursorRow: 0,
605
- cursorCol: 0,
606
- pastedContent: { [singleLinePlaceholder]: singleLineContent },
607
- });
608
- const state = textBufferReducer(stateWithPlaceholder, {
609
- type: 'toggle_paste_expansion',
610
- payload: { id: singleLinePlaceholder, row: 0, col: 0 },
611
- });
612
- expect(state.lines).toEqual(['some text']);
613
- expect(state.cursorRow).toBe(0);
614
- expect(state.cursorCol).toBe(9);
615
- });
616
- it('should return current state if placeholder ID not found in pastedContent', async () => {
617
- const action = {
618
- type: 'toggle_paste_expansion',
619
- payload: { id: 'unknown', row: 0, col: 0 },
620
- };
621
- const state = textBufferReducer(initialState, action);
622
- expect(state).toBe(initialState);
623
- });
624
- it('should preserve expandedPaste when lines change from edits outside the region', async () => {
625
- // Start with an expanded paste at line 0 (3 lines long)
626
- const placeholder = '[Pasted Text: 3 lines]';
627
- const expandedState = createStateWithTransformations({
628
- lines: ['line1', 'line2', 'line3', 'suffix'],
629
- cursorRow: 3,
630
- cursorCol: 0,
631
- pastedContent: { [placeholder]: 'line1\nline2\nline3' },
632
- expandedPaste: {
633
- id: placeholder,
634
- startLine: 0,
635
- lineCount: 3,
636
- prefix: '',
637
- suffix: '',
638
- },
639
- });
640
- expect(expandedState.expandedPaste).not.toBeNull();
641
- // Insert a newline at the end - this changes lines but is OUTSIDE the expanded region
642
- const stateAfterInsert = textBufferReducer(expandedState, {
643
- type: 'insert',
644
- payload: '\n',
645
- });
646
- // Lines changed, but expandedPaste should be PRESERVED and optionally shifted (no shift here since edit is after)
647
- expect(stateAfterInsert.expandedPaste).not.toBeNull();
648
- expect(stateAfterInsert.expandedPaste?.id).toBe(placeholder);
649
- });
650
- });
651
- });
652
- const getBufferState = (result) => {
653
- expect(result.current).toHaveOnlyValidCharacters();
654
- return {
655
- text: result.current.text,
656
- lines: [...result.current.lines], // Clone for safety
657
- cursor: [...result.current.cursor],
658
- allVisualLines: [...result.current.allVisualLines],
659
- viewportVisualLines: [...result.current.viewportVisualLines],
660
- visualCursor: [...result.current.visualCursor],
661
- visualScrollRow: result.current.visualScrollRow,
662
- preferredCol: result.current.preferredCol,
663
- };
664
- };
665
- describe('useTextBuffer', () => {
666
- let viewport;
667
- beforeEach(() => {
668
- viewport = { width: 10, height: 3 }; // Default viewport for tests
669
- });
670
- afterEach(() => {
671
- vi.restoreAllMocks();
672
- });
673
- describe('Initialization', () => {
674
- it('should initialize with empty text and cursor at (0,0) by default', async () => {
675
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
676
- const state = getBufferState(result);
677
- expect(state.text).toBe('');
678
- expect(state.lines).toEqual(['']);
679
- expect(state.cursor).toEqual([0, 0]);
680
- expect(state.allVisualLines).toEqual(['']);
681
- expect(state.viewportVisualLines).toEqual(['']);
682
- expect(state.visualCursor).toEqual([0, 0]);
683
- expect(state.visualScrollRow).toBe(0);
684
- });
685
- it('should initialize with provided initialText', async () => {
686
- const { result } = await renderHook(() => useTextBuffer({
687
- initialText: 'hello',
688
- viewport,
689
- }));
690
- const state = getBufferState(result);
691
- expect(state.text).toBe('hello');
692
- expect(state.lines).toEqual(['hello']);
693
- expect(state.cursor).toEqual([0, 0]); // Default cursor if offset not given
694
- expect(state.allVisualLines).toEqual(['hello']);
695
- expect(state.viewportVisualLines).toEqual(['hello']);
696
- expect(state.visualCursor).toEqual([0, 0]);
697
- });
698
- it('should initialize with initialText and initialCursorOffset', async () => {
699
- const { result } = await renderHook(() => useTextBuffer({
700
- initialText: 'hello\nworld',
701
- initialCursorOffset: 7, // Should be at 'o' in 'world'
702
- viewport,
703
- }));
704
- const state = getBufferState(result);
705
- expect(state.text).toBe('hello\nworld');
706
- expect(state.lines).toEqual(['hello', 'world']);
707
- expect(state.cursor).toEqual([1, 1]); // Logical cursor at 'o' in "world"
708
- expect(state.allVisualLines).toEqual(['hello', 'world']);
709
- expect(state.viewportVisualLines).toEqual(['hello', 'world']);
710
- expect(state.visualCursor[0]).toBe(1); // On the second visual line
711
- expect(state.visualCursor[1]).toBe(1); // At 'o' in "world"
712
- });
713
- it('should wrap visual lines', async () => {
714
- const { result } = await renderHook(() => useTextBuffer({
715
- initialText: 'The quick brown fox jumps over the lazy dog.',
716
- initialCursorOffset: 2, // After '好'
717
- viewport: { width: 15, height: 4 },
718
- }));
719
- const state = getBufferState(result);
720
- expect(state.allVisualLines).toEqual([
721
- 'The quick',
722
- 'brown fox',
723
- 'jumps over the',
724
- 'lazy dog.',
725
- ]);
726
- });
727
- it('should wrap visual lines with multiple spaces', async () => {
728
- const { result } = await renderHook(() => useTextBuffer({
729
- initialText: 'The quick brown fox jumps over the lazy dog.',
730
- viewport: { width: 15, height: 4 },
731
- }));
732
- const state = getBufferState(result);
733
- // Including multiple spaces at the end of the lines like this is
734
- // consistent with Google docs behavior and makes it intuitive to edit
735
- // the spaces as needed.
736
- expect(state.allVisualLines).toEqual([
737
- 'The quick ',
738
- 'brown fox ',
739
- 'jumps over the',
740
- 'lazy dog.',
741
- ]);
742
- });
743
- it('should wrap visual lines even without spaces', async () => {
744
- const { result } = await renderHook(() => useTextBuffer({
745
- initialText: '123456789012345ABCDEFG', // 4 chars, 12 bytes
746
- viewport: { width: 15, height: 2 },
747
- }));
748
- const state = getBufferState(result);
749
- // Including multiple spaces at the end of the lines like this is
750
- // consistent with Google docs behavior and makes it intuitive to edit
751
- // the spaces as needed.
752
- expect(state.allVisualLines).toEqual(['123456789012345', 'ABCDEFG']);
753
- });
754
- it('should initialize with multi-byte unicode characters and correct cursor offset', async () => {
755
- const { result } = await renderHook(() => useTextBuffer({
756
- initialText: '你好世界', // 4 chars, 12 bytes
757
- initialCursorOffset: 2, // After '好'
758
- viewport: { width: 5, height: 2 },
759
- }));
760
- const state = getBufferState(result);
761
- expect(state.text).toBe('你好世界');
762
- expect(state.lines).toEqual(['你好世界']);
763
- expect(state.cursor).toEqual([0, 2]);
764
- // Visual: "你好" (width 4), "世"界" (width 4) with viewport width 5
765
- expect(state.allVisualLines).toEqual(['你好', '世界']);
766
- expect(state.visualCursor).toEqual([1, 0]);
767
- });
768
- });
769
- describe('Basic Editing', () => {
770
- it('insert: should insert a character and update cursor', async () => {
771
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
772
- act(() => result.current.insert('a'));
773
- let state = getBufferState(result);
774
- expect(state.text).toBe('a');
775
- expect(state.cursor).toEqual([0, 1]);
776
- expect(state.visualCursor).toEqual([0, 1]);
777
- act(() => result.current.insert('b'));
778
- state = getBufferState(result);
779
- expect(state.text).toBe('ab');
780
- expect(state.cursor).toEqual([0, 2]);
781
- expect(state.visualCursor).toEqual([0, 2]);
782
- });
783
- it('insert: should insert text in the middle of a line', async () => {
784
- const { result } = await renderHook(() => useTextBuffer({
785
- initialText: 'abc',
786
- viewport,
787
- }));
788
- act(() => result.current.move('right'));
789
- act(() => result.current.insert('-NEW-'));
790
- const state = getBufferState(result);
791
- expect(state.text).toBe('a-NEW-bc');
792
- expect(state.cursor).toEqual([0, 6]);
793
- });
794
- it('insert: should use placeholder for large text paste', async () => {
795
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
796
- const largeText = '1\n2\n3\n4\n5\n6';
797
- act(() => result.current.insert(largeText, { paste: true }));
798
- const state = getBufferState(result);
799
- expect(state.text).toBe('[Pasted Text: 6 lines]');
800
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
801
- });
802
- it('insert: should NOT use placeholder for large text if NOT a paste', async () => {
803
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
804
- const largeText = '1\n2\n3\n4\n5\n6';
805
- act(() => result.current.insert(largeText, { paste: false }));
806
- const state = getBufferState(result);
807
- expect(state.text).toBe(largeText);
808
- });
809
- it('insert: should clean up pastedContent when placeholder is deleted', async () => {
810
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
811
- const largeText = '1\n2\n3\n4\n5\n6';
812
- act(() => result.current.insert(largeText, { paste: true }));
813
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
814
- // Delete the placeholder using setText
815
- act(() => result.current.setText(''));
816
- expect(Object.keys(result.current.pastedContent)).toHaveLength(0);
817
- });
818
- it('insert: should clean up pastedContent when placeholder is removed via atomic backspace', async () => {
819
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
820
- const largeText = '1\n2\n3\n4\n5\n6';
821
- act(() => result.current.insert(largeText, { paste: true }));
822
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
823
- // Single backspace at end of placeholder removes entire placeholder
824
- act(() => {
825
- result.current.backspace();
826
- });
827
- expect(getBufferState(result).text).toBe('');
828
- // pastedContent is cleaned up when placeholder is deleted atomically
829
- expect(Object.keys(result.current.pastedContent)).toHaveLength(0);
830
- });
831
- it('deleteWordLeft: should clean up pastedContent and avoid #2 suffix on repaste', async () => {
832
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
833
- const largeText = '1\n2\n3\n4\n5\n6';
834
- act(() => result.current.insert(largeText, { paste: true }));
835
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
836
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
837
- act(() => {
838
- for (let i = 0; i < 12; i++) {
839
- result.current.deleteWordLeft();
840
- }
841
- });
842
- expect(getBufferState(result).text).toBe('');
843
- expect(Object.keys(result.current.pastedContent)).toHaveLength(0);
844
- act(() => result.current.insert(largeText, { paste: true }));
845
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
846
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
847
- });
848
- it('deleteWordRight: should clean up pastedContent and avoid #2 suffix on repaste', async () => {
849
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
850
- const largeText = '1\n2\n3\n4\n5\n6';
851
- act(() => result.current.insert(largeText, { paste: true }));
852
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
853
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
854
- act(() => result.current.move('home'));
855
- act(() => {
856
- for (let i = 0; i < 12; i++) {
857
- result.current.deleteWordRight();
858
- }
859
- });
860
- expect(getBufferState(result).text).not.toContain('[Pasted Text: 6 lines]');
861
- expect(Object.keys(result.current.pastedContent)).toHaveLength(0);
862
- act(() => result.current.insert(largeText, { paste: true }));
863
- expect(getBufferState(result).text).toContain('[Pasted Text: 6 lines]');
864
- expect(getBufferState(result).text).not.toContain('#2');
865
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
866
- });
867
- it('killLineLeft: should clean up pastedContent and avoid #2 suffix on repaste', async () => {
868
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
869
- const largeText = '1\n2\n3\n4\n5\n6';
870
- act(() => result.current.insert(largeText, { paste: true }));
871
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
872
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
873
- act(() => result.current.killLineLeft());
874
- expect(getBufferState(result).text).toBe('');
875
- expect(Object.keys(result.current.pastedContent)).toHaveLength(0);
876
- act(() => result.current.insert(largeText, { paste: true }));
877
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
878
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
879
- });
880
- it('killLineRight: should clean up pastedContent and avoid #2 suffix on repaste', async () => {
881
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
882
- const largeText = '1\n2\n3\n4\n5\n6';
883
- act(() => result.current.insert(largeText, { paste: true }));
884
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
885
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
886
- act(() => {
887
- for (let i = 0; i < 40; i++) {
888
- result.current.move('left');
889
- }
890
- });
891
- act(() => result.current.killLineRight());
892
- expect(getBufferState(result).text).toBe('');
893
- expect(Object.keys(result.current.pastedContent)).toHaveLength(0);
894
- act(() => result.current.insert(largeText, { paste: true }));
895
- expect(getBufferState(result).text).toBe('[Pasted Text: 6 lines]');
896
- expect(result.current.pastedContent['[Pasted Text: 6 lines]']).toBe(largeText);
897
- });
898
- it('newline: should create a new line and move cursor', async () => {
899
- const { result } = await renderHook(() => useTextBuffer({
900
- initialText: 'ab',
901
- viewport,
902
- }));
903
- act(() => result.current.move('end')); // cursor at [0,2]
904
- act(() => result.current.newline());
905
- const state = getBufferState(result);
906
- expect(state.text).toBe('ab\n');
907
- expect(state.lines).toEqual(['ab', '']);
908
- expect(state.cursor).toEqual([1, 0]);
909
- expect(state.allVisualLines).toEqual(['ab', '']);
910
- expect(state.viewportVisualLines).toEqual(['ab', '']); // viewport height 3
911
- expect(state.visualCursor).toEqual([1, 0]); // On the new visual line
912
- });
913
- it('backspace: should delete char to the left or merge lines', async () => {
914
- const { result } = await renderHook(() => useTextBuffer({
915
- initialText: 'a\nb',
916
- viewport,
917
- }));
918
- act(() => {
919
- result.current.move('down');
920
- });
921
- act(() => {
922
- result.current.move('end'); // cursor to [1,1] (end of 'b')
923
- });
924
- act(() => result.current.backspace()); // delete 'b'
925
- let state = getBufferState(result);
926
- expect(state.text).toBe('a\n');
927
- expect(state.cursor).toEqual([1, 0]);
928
- act(() => result.current.backspace()); // merge lines
929
- state = getBufferState(result);
930
- expect(state.text).toBe('a');
931
- expect(state.cursor).toEqual([0, 1]); // cursor after 'a'
932
- expect(state.allVisualLines).toEqual(['a']);
933
- expect(state.viewportVisualLines).toEqual(['a']);
934
- expect(state.visualCursor).toEqual([0, 1]);
935
- });
936
- it('del: should delete char to the right or merge lines', async () => {
937
- const { result } = await renderHook(() => useTextBuffer({
938
- initialText: 'a\nb',
939
- viewport,
940
- }));
941
- // cursor at [0,0]
942
- act(() => result.current.del()); // delete 'a'
943
- let state = getBufferState(result);
944
- expect(state.text).toBe('\nb');
945
- expect(state.cursor).toEqual([0, 0]);
946
- act(() => result.current.del()); // merge lines (deletes newline)
947
- state = getBufferState(result);
948
- expect(state.text).toBe('b');
949
- expect(state.cursor).toEqual([0, 0]);
950
- expect(state.allVisualLines).toEqual(['b']);
951
- expect(state.viewportVisualLines).toEqual(['b']);
952
- expect(state.visualCursor).toEqual([0, 0]);
953
- });
954
- });
955
- describe('Drag and Drop File Paths', () => {
956
- let tempDir;
957
- beforeEach(() => {
958
- tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gemini-cli-test-'));
959
- });
960
- afterEach(() => {
961
- fs.rmSync(tempDir, { recursive: true, force: true });
962
- });
963
- it('should prepend @ to a valid file path on insert', async () => {
964
- const filePath = path.join(tempDir, 'file.txt');
965
- fs.writeFileSync(filePath, '');
966
- const { result } = await renderHook(() => useTextBuffer({ viewport, escapePastedPaths: true }));
967
- act(() => result.current.insert(filePath, { paste: true }));
968
- expect(getBufferState(result).text).toBe(`@${escapePath(filePath)} `);
969
- });
970
- it('should not prepend @ to an invalid file path on insert', async () => {
971
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
972
- const notAPath = path.join(tempDir, 'non_existent.txt');
973
- act(() => result.current.insert(notAPath, { paste: true }));
974
- expect(getBufferState(result).text).toBe(notAPath);
975
- });
976
- it('should handle quoted paths', async () => {
977
- const filePath = path.join(tempDir, 'file.txt');
978
- fs.writeFileSync(filePath, '');
979
- const { result } = await renderHook(() => useTextBuffer({ viewport, escapePastedPaths: true }));
980
- const quotedPath = `'${filePath}'`;
981
- act(() => result.current.insert(quotedPath, { paste: true }));
982
- expect(getBufferState(result).text).toBe(`@${escapePath(filePath)} `);
983
- });
984
- it('should not prepend @ to short text that is not a path', async () => {
985
- const { result } = await renderHook(() => useTextBuffer({ viewport, escapePastedPaths: true }));
986
- const shortText = 'ab';
987
- act(() => result.current.insert(shortText, { paste: true }));
988
- expect(getBufferState(result).text).toBe(shortText);
989
- });
990
- it('should prepend @ to multiple valid file paths on insert', async () => {
991
- const file1 = path.join(tempDir, 'file1.txt');
992
- const file2 = path.join(tempDir, 'file2.txt');
993
- fs.writeFileSync(file1, '');
994
- fs.writeFileSync(file2, '');
995
- const { result } = await renderHook(() => useTextBuffer({ viewport, escapePastedPaths: true }));
996
- const filePaths = `${escapePath(file1)} ${escapePath(file2)}`;
997
- act(() => result.current.insert(filePaths, { paste: true }));
998
- expect(getBufferState(result).text).toBe(`@${escapePath(file1)} @${escapePath(file2)} `);
999
- });
1000
- it('should handle multiple paths with escaped spaces', async () => {
1001
- const file1 = path.join(tempDir, 'my file.txt');
1002
- const file2 = path.join(tempDir, 'other.txt');
1003
- fs.writeFileSync(file1, '');
1004
- fs.writeFileSync(file2, '');
1005
- const { result } = await renderHook(() => useTextBuffer({ viewport, escapePastedPaths: true }));
1006
- const filePaths = `${escapePath(file1)} ${escapePath(file2)}`;
1007
- act(() => result.current.insert(filePaths, { paste: true }));
1008
- expect(getBufferState(result).text).toBe(`@${escapePath(file1)} @${escapePath(file2)} `);
1009
- });
1010
- it('should not prepend @ unless all paths are valid', async () => {
1011
- const validFile = path.join(tempDir, 'valid.txt');
1012
- const invalidFile = path.join(tempDir, 'invalid.jpg');
1013
- fs.writeFileSync(validFile, '');
1014
- // Do not create invalidFile
1015
- const { result } = await renderHook(() => useTextBuffer({
1016
- viewport,
1017
- escapePastedPaths: true,
1018
- }));
1019
- const filePaths = `${validFile} ${invalidFile}`;
1020
- act(() => result.current.insert(filePaths, { paste: true }));
1021
- expect(getBufferState(result).text).toBe(`${validFile} ${invalidFile}`);
1022
- });
1023
- });
1024
- describe('Shell Mode Behavior', () => {
1025
- it('should not prepend @ to valid file paths when shellModeActive is true', async () => {
1026
- const { result } = await renderHook(() => useTextBuffer({
1027
- viewport,
1028
- escapePastedPaths: true,
1029
- shellModeActive: true,
1030
- }));
1031
- const filePath = '/path/to/a/valid/file.txt';
1032
- act(() => result.current.insert(filePath, { paste: true }));
1033
- expect(getBufferState(result).text).toBe(filePath); // No @ prefix
1034
- });
1035
- it('should not prepend @ to quoted paths when shellModeActive is true', async () => {
1036
- const { result } = await renderHook(() => useTextBuffer({
1037
- viewport,
1038
- escapePastedPaths: true,
1039
- shellModeActive: true,
1040
- }));
1041
- const quotedFilePath = "'/path/to/a/valid/file.txt'";
1042
- act(() => result.current.insert(quotedFilePath, { paste: true }));
1043
- expect(getBufferState(result).text).toBe(quotedFilePath); // No @ prefix, keeps quotes
1044
- });
1045
- it('should behave normally with invalid paths when shellModeActive is true', async () => {
1046
- const { result } = await renderHook(() => useTextBuffer({
1047
- viewport,
1048
- shellModeActive: true,
1049
- }));
1050
- const notAPath = 'this is just some text';
1051
- act(() => result.current.insert(notAPath, { paste: true }));
1052
- expect(getBufferState(result).text).toBe(notAPath);
1053
- });
1054
- it('should behave normally with short text when shellModeActive is true', async () => {
1055
- const { result } = await renderHook(() => useTextBuffer({
1056
- viewport,
1057
- escapePastedPaths: true,
1058
- shellModeActive: true,
1059
- }));
1060
- const shortText = 'ls';
1061
- act(() => result.current.insert(shortText, { paste: true }));
1062
- expect(getBufferState(result).text).toBe(shortText); // No @ prefix for short text
1063
- });
1064
- });
1065
- describe('Cursor Movement', () => {
1066
- it('move: left/right should work within and across visual lines (due to wrapping)', async () => {
1067
- // Text: "long line1next line2" (20 chars)
1068
- // Viewport width 5. Word wrapping should produce:
1069
- // "long " (5)
1070
- // "line1" (5)
1071
- // "next " (5)
1072
- // "line2" (5)
1073
- const { result } = await renderHook(() => useTextBuffer({
1074
- initialText: 'long line1next line2', // Corrected: was 'long line1next line2'
1075
- viewport: { width: 5, height: 4 },
1076
- }));
1077
- // Initial cursor [0,0] logical, visual [0,0] ("l" of "long ")
1078
- act(() => result.current.move('right')); // visual [0,1] ("o")
1079
- expect(getBufferState(result).visualCursor).toEqual([0, 1]);
1080
- act(() => result.current.move('right')); // visual [0,2] ("n")
1081
- act(() => result.current.move('right')); // visual [0,3] ("g")
1082
- act(() => result.current.move('right')); // visual [0,4] (" ")
1083
- expect(getBufferState(result).visualCursor).toEqual([0, 4]);
1084
- act(() => result.current.move('right')); // visual [1,0] ("l" of "line1")
1085
- expect(getBufferState(result).visualCursor).toEqual([1, 0]);
1086
- expect(getBufferState(result).cursor).toEqual([0, 5]); // logical cursor
1087
- act(() => result.current.move('left')); // visual [0,4] (" " of "long ")
1088
- expect(getBufferState(result).visualCursor).toEqual([0, 4]);
1089
- expect(getBufferState(result).cursor).toEqual([0, 4]); // logical cursor
1090
- });
1091
- it('move: up/down should preserve preferred visual column', async () => {
1092
- const text = 'abcde\nxy\n12345';
1093
- const { result } = await renderHook(() => useTextBuffer({
1094
- initialText: text,
1095
- viewport,
1096
- }));
1097
- expect(result.current.allVisualLines).toEqual(['abcde', 'xy', '12345']);
1098
- // Place cursor at the end of "abcde" -> logical [0,5]
1099
- act(() => {
1100
- result.current.move('home'); // to [0,0]
1101
- });
1102
- for (let i = 0; i < 5; i++) {
1103
- act(() => {
1104
- result.current.move('right'); // to [0,5]
1105
- });
1106
- }
1107
- expect(getBufferState(result).cursor).toEqual([0, 5]);
1108
- expect(getBufferState(result).visualCursor).toEqual([0, 5]);
1109
- // Set preferredCol by moving up then down to the same spot, then test.
1110
- act(() => {
1111
- result.current.move('down'); // to xy, logical [1,2], visual [1,2], preferredCol should be 5
1112
- });
1113
- let state = getBufferState(result);
1114
- expect(state.cursor).toEqual([1, 2]); // Logical cursor at end of 'xy'
1115
- expect(state.visualCursor).toEqual([1, 2]); // Visual cursor at end of 'xy'
1116
- expect(state.preferredCol).toBe(5);
1117
- act(() => result.current.move('down')); // to '12345', preferredCol=5.
1118
- state = getBufferState(result);
1119
- expect(state.cursor).toEqual([2, 5]); // Logical cursor at end of '12345'
1120
- expect(state.visualCursor).toEqual([2, 5]); // Visual cursor at end of '12345'
1121
- expect(state.preferredCol).toBe(5); // Preferred col is maintained
1122
- act(() => result.current.move('left')); // preferredCol should reset
1123
- state = getBufferState(result);
1124
- expect(state.preferredCol).toBe(null);
1125
- });
1126
- it('move: home/end should go to visual line start/end', async () => {
1127
- const initialText = 'line one\nsecond line';
1128
- const { result } = await renderHook(() => useTextBuffer({
1129
- initialText,
1130
- viewport: { width: 5, height: 5 },
1131
- }));
1132
- expect(result.current.allVisualLines).toEqual([
1133
- 'line',
1134
- 'one',
1135
- 'secon',
1136
- 'd',
1137
- 'line',
1138
- ]);
1139
- // Initial cursor [0,0] (start of "line")
1140
- act(() => result.current.move('down')); // visual cursor from [0,0] to [1,0] ("o" of "one")
1141
- act(() => result.current.move('right')); // visual cursor to [1,1] ("n" of "one")
1142
- expect(getBufferState(result).visualCursor).toEqual([1, 1]);
1143
- act(() => result.current.move('home')); // visual cursor to [1,0] (start of "one")
1144
- expect(getBufferState(result).visualCursor).toEqual([1, 0]);
1145
- act(() => result.current.move('end')); // visual cursor to [1,3] (end of "one")
1146
- expect(getBufferState(result).visualCursor).toEqual([1, 3]); // "one" is 3 chars
1147
- });
1148
- });
1149
- describe('Visual Layout & Viewport', () => {
1150
- it('should wrap long lines correctly into visualLines', async () => {
1151
- const { result } = await renderHook(() => useTextBuffer({
1152
- initialText: 'This is a very long line of text.', // 33 chars
1153
- viewport: { width: 10, height: 5 },
1154
- }));
1155
- const state = getBufferState(result);
1156
- // Expected visual lines with word wrapping (viewport width 10):
1157
- // "This is a"
1158
- // "very long"
1159
- // "line of"
1160
- // "text."
1161
- expect(state.allVisualLines.length).toBe(4);
1162
- expect(state.allVisualLines[0]).toBe('This is a');
1163
- expect(state.allVisualLines[1]).toBe('very long');
1164
- expect(state.allVisualLines[2]).toBe('line of');
1165
- expect(state.allVisualLines[3]).toBe('text.');
1166
- });
1167
- it('should update visualScrollRow when visualCursor moves out of viewport', async () => {
1168
- const { result } = await renderHook(() => useTextBuffer({
1169
- initialText: 'l1\nl2\nl3\nl4\nl5',
1170
- viewport: { width: 5, height: 3 }, // Can show 3 visual lines
1171
- }));
1172
- // Initial: l1, l2, l3 visible. visualScrollRow = 0. visualCursor = [0,0]
1173
- expect(getBufferState(result).visualScrollRow).toBe(0);
1174
- expect(getBufferState(result).allVisualLines).toEqual([
1175
- 'l1',
1176
- 'l2',
1177
- 'l3',
1178
- 'l4',
1179
- 'l5',
1180
- ]);
1181
- expect(getBufferState(result).viewportVisualLines).toEqual([
1182
- 'l1',
1183
- 'l2',
1184
- 'l3',
1185
- ]);
1186
- act(() => result.current.move('down')); // vc=[1,0]
1187
- act(() => result.current.move('down')); // vc=[2,0] (l3)
1188
- expect(getBufferState(result).visualScrollRow).toBe(0);
1189
- act(() => result.current.move('down')); // vc=[3,0] (l4) - scroll should happen
1190
- // Now: l2, l3, l4 visible. visualScrollRow = 1.
1191
- let state = getBufferState(result);
1192
- expect(state.visualScrollRow).toBe(1);
1193
- expect(state.allVisualLines).toEqual(['l1', 'l2', 'l3', 'l4', 'l5']);
1194
- expect(state.viewportVisualLines).toEqual(['l2', 'l3', 'l4']);
1195
- expect(state.visualCursor).toEqual([3, 0]);
1196
- act(() => result.current.move('up')); // vc=[2,0] (l3)
1197
- act(() => result.current.move('up')); // vc=[1,0] (l2)
1198
- expect(getBufferState(result).visualScrollRow).toBe(1);
1199
- act(() => result.current.move('up')); // vc=[0,0] (l1) - scroll up
1200
- // Now: l1, l2, l3 visible. visualScrollRow = 0
1201
- state = getBufferState(result); // Assign to the existing `state` variable
1202
- expect(state.visualScrollRow).toBe(0);
1203
- expect(state.allVisualLines).toEqual(['l1', 'l2', 'l3', 'l4', 'l5']);
1204
- expect(state.viewportVisualLines).toEqual(['l1', 'l2', 'l3']);
1205
- expect(state.visualCursor).toEqual([0, 0]);
1206
- });
1207
- });
1208
- describe('Undo/Redo', () => {
1209
- it('should undo and redo an insert operation', async () => {
1210
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1211
- act(() => result.current.insert('a'));
1212
- expect(getBufferState(result).text).toBe('a');
1213
- act(() => result.current.undo());
1214
- expect(getBufferState(result).text).toBe('');
1215
- expect(getBufferState(result).cursor).toEqual([0, 0]);
1216
- act(() => result.current.redo());
1217
- expect(getBufferState(result).text).toBe('a');
1218
- expect(getBufferState(result).cursor).toEqual([0, 1]);
1219
- });
1220
- it('should undo and redo a newline operation', async () => {
1221
- const { result } = await renderHook(() => useTextBuffer({
1222
- initialText: 'test',
1223
- viewport,
1224
- }));
1225
- act(() => result.current.move('end'));
1226
- act(() => result.current.newline());
1227
- expect(getBufferState(result).text).toBe('test\n');
1228
- act(() => result.current.undo());
1229
- expect(getBufferState(result).text).toBe('test');
1230
- expect(getBufferState(result).cursor).toEqual([0, 4]);
1231
- act(() => result.current.redo());
1232
- expect(getBufferState(result).text).toBe('test\n');
1233
- expect(getBufferState(result).cursor).toEqual([1, 0]);
1234
- });
1235
- });
1236
- describe('Unicode Handling', () => {
1237
- it('insert: should correctly handle multi-byte unicode characters', async () => {
1238
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1239
- act(() => result.current.insert('你好'));
1240
- const state = getBufferState(result);
1241
- expect(state.text).toBe('你好');
1242
- expect(state.cursor).toEqual([0, 2]); // Cursor is 2 (char count)
1243
- expect(state.visualCursor).toEqual([0, 2]);
1244
- });
1245
- it('backspace: should correctly delete multi-byte unicode characters', async () => {
1246
- const { result } = await renderHook(() => useTextBuffer({
1247
- initialText: '你好',
1248
- viewport,
1249
- }));
1250
- act(() => result.current.move('end')); // cursor at [0,2]
1251
- act(() => result.current.backspace()); // delete '好'
1252
- let state = getBufferState(result);
1253
- expect(state.text).toBe('你');
1254
- expect(state.cursor).toEqual([0, 1]);
1255
- act(() => result.current.backspace()); // delete '你'
1256
- state = getBufferState(result);
1257
- expect(state.text).toBe('');
1258
- expect(state.cursor).toEqual([0, 0]);
1259
- });
1260
- it('move: left/right should treat multi-byte chars as single units for visual cursor', async () => {
1261
- const { result } = await renderHook(() => useTextBuffer({
1262
- initialText: '🐶🐱',
1263
- viewport: { width: 5, height: 1 },
1264
- }));
1265
- // Initial: visualCursor [0,0]
1266
- act(() => result.current.move('right')); // visualCursor [0,1] (after 🐶)
1267
- let state = getBufferState(result);
1268
- expect(state.cursor).toEqual([0, 1]);
1269
- expect(state.visualCursor).toEqual([0, 1]);
1270
- act(() => result.current.move('right')); // visualCursor [0,2] (after 🐱)
1271
- state = getBufferState(result);
1272
- expect(state.cursor).toEqual([0, 2]);
1273
- expect(state.visualCursor).toEqual([0, 2]);
1274
- act(() => result.current.move('left')); // visualCursor [0,1] (before 🐱 / after 🐶)
1275
- state = getBufferState(result);
1276
- expect(state.cursor).toEqual([0, 1]);
1277
- expect(state.visualCursor).toEqual([0, 1]);
1278
- });
1279
- it('move: up/down should work on wrapped lines (regression test)', async () => {
1280
- // Line that wraps into two visual lines
1281
- // Viewport width 10. "0123456789ABCDE" (15 chars)
1282
- // Visual Line 0: "0123456789"
1283
- // Visual Line 1: "ABCDE"
1284
- const { result } = await renderHook(() => useTextBuffer({
1285
- viewport: { width: 10, height: 5 },
1286
- }));
1287
- act(() => {
1288
- result.current.setText('0123456789ABCDE');
1289
- });
1290
- // Cursor should be at the end: logical [0, 15], visual [1, 5]
1291
- expect(getBufferState(result).cursor).toEqual([0, 15]);
1292
- expect(getBufferState(result).visualCursor).toEqual([1, 5]);
1293
- // Press Up arrow - should move to first visual line
1294
- // This currently fails because handleInput returns false if cursorRow === 0
1295
- let handledUp = false;
1296
- act(() => {
1297
- handledUp = result.current.handleInput({
1298
- name: 'up',
1299
- shift: false,
1300
- alt: false,
1301
- ctrl: false,
1302
- cmd: false,
1303
- insertable: false,
1304
- sequence: '\x1b[A',
1305
- });
1306
- });
1307
- expect(handledUp).toBe(true);
1308
- expect(getBufferState(result).visualCursor[0]).toBe(0);
1309
- // Press Down arrow - should move back to second visual line
1310
- // This would also fail if cursorRow is the last logical row
1311
- let handledDown = false;
1312
- act(() => {
1313
- handledDown = result.current.handleInput({
1314
- name: 'down',
1315
- shift: false,
1316
- alt: false,
1317
- ctrl: false,
1318
- cmd: false,
1319
- insertable: false,
1320
- sequence: '\x1b[B',
1321
- });
1322
- });
1323
- expect(handledDown).toBe(true);
1324
- expect(getBufferState(result).visualCursor[0]).toBe(1);
1325
- });
1326
- it('moveToVisualPosition: should correctly handle wide characters (Chinese)', async () => {
1327
- const { result } = await renderHook(() => useTextBuffer({
1328
- initialText: '你好', // 2 chars, width 4
1329
- viewport: { width: 10, height: 1 },
1330
- }));
1331
- // '你' (width 2): visual 0-1. '好' (width 2): visual 2-3.
1332
- // Click on '你' (first half, x=0) -> index 0
1333
- act(() => result.current.moveToVisualPosition(0, 0));
1334
- expect(getBufferState(result).cursor).toEqual([0, 0]);
1335
- // Click on '你' (second half, x=1) -> index 1 (after first char)
1336
- act(() => result.current.moveToVisualPosition(0, 1));
1337
- expect(getBufferState(result).cursor).toEqual([0, 1]);
1338
- // Click on '好' (first half, x=2) -> index 1 (before second char)
1339
- act(() => result.current.moveToVisualPosition(0, 2));
1340
- expect(getBufferState(result).cursor).toEqual([0, 1]);
1341
- // Click on '好' (second half, x=3) -> index 2 (after second char)
1342
- act(() => result.current.moveToVisualPosition(0, 3));
1343
- expect(getBufferState(result).cursor).toEqual([0, 2]);
1344
- });
1345
- });
1346
- describe('handleInput', () => {
1347
- it('should insert printable characters', async () => {
1348
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1349
- act(() => {
1350
- result.current.handleInput({
1351
- name: 'h',
1352
- shift: false,
1353
- alt: false,
1354
- ctrl: false,
1355
- cmd: false,
1356
- insertable: true,
1357
- sequence: 'h',
1358
- });
1359
- });
1360
- void act(() => result.current.handleInput({
1361
- name: 'i',
1362
- shift: false,
1363
- alt: false,
1364
- ctrl: false,
1365
- cmd: false,
1366
- insertable: true,
1367
- sequence: 'i',
1368
- }));
1369
- expect(getBufferState(result).text).toBe('hi');
1370
- });
1371
- it('should handle "Enter" key as newline', async () => {
1372
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1373
- act(() => {
1374
- result.current.handleInput({
1375
- name: 'enter',
1376
- shift: false,
1377
- alt: false,
1378
- ctrl: false,
1379
- cmd: false,
1380
- insertable: true,
1381
- sequence: '\r',
1382
- });
1383
- });
1384
- expect(getBufferState(result).lines).toEqual(['', '']);
1385
- });
1386
- it('should handle Ctrl+J as newline', async () => {
1387
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1388
- act(() => {
1389
- result.current.handleInput({
1390
- name: 'j',
1391
- shift: false,
1392
- alt: false,
1393
- ctrl: true,
1394
- cmd: false,
1395
- insertable: false,
1396
- sequence: '\n',
1397
- });
1398
- });
1399
- expect(getBufferState(result).lines).toEqual(['', '']);
1400
- });
1401
- it('should do nothing for a tab key press', async () => {
1402
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1403
- act(() => {
1404
- result.current.handleInput({
1405
- name: 'tab',
1406
- shift: false,
1407
- alt: false,
1408
- ctrl: false,
1409
- cmd: false,
1410
- insertable: false,
1411
- sequence: '\t',
1412
- });
1413
- });
1414
- expect(getBufferState(result).text).toBe('');
1415
- });
1416
- it('should do nothing for a shift tab key press', async () => {
1417
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1418
- act(() => {
1419
- result.current.handleInput({
1420
- name: 'tab',
1421
- shift: true,
1422
- alt: false,
1423
- ctrl: false,
1424
- cmd: false,
1425
- insertable: false,
1426
- sequence: '\u001b[9;2u',
1427
- });
1428
- });
1429
- expect(getBufferState(result).text).toBe('');
1430
- });
1431
- it('should handle CLEAR_INPUT (Ctrl+C)', async () => {
1432
- const { result } = await renderHook(() => useTextBuffer({
1433
- initialText: 'hello',
1434
- viewport,
1435
- }));
1436
- expect(getBufferState(result).text).toBe('hello');
1437
- let handled = false;
1438
- act(() => {
1439
- handled = result.current.handleInput({
1440
- name: 'c',
1441
- shift: false,
1442
- alt: false,
1443
- ctrl: true,
1444
- cmd: false,
1445
- insertable: false,
1446
- sequence: '\u0003',
1447
- });
1448
- });
1449
- expect(handled).toBe(true);
1450
- expect(getBufferState(result).text).toBe('');
1451
- });
1452
- it('should NOT handle CLEAR_INPUT if buffer is empty', async () => {
1453
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1454
- let handled = true;
1455
- act(() => {
1456
- handled = result.current.handleInput({
1457
- name: 'c',
1458
- shift: false,
1459
- alt: false,
1460
- ctrl: true,
1461
- cmd: false,
1462
- insertable: false,
1463
- sequence: '\u0003',
1464
- });
1465
- });
1466
- expect(handled).toBe(false);
1467
- });
1468
- it('should handle "Backspace" key', async () => {
1469
- const { result } = await renderHook(() => useTextBuffer({
1470
- initialText: 'a',
1471
- viewport,
1472
- }));
1473
- act(() => result.current.move('end'));
1474
- act(() => {
1475
- result.current.handleInput({
1476
- name: 'backspace',
1477
- shift: false,
1478
- alt: false,
1479
- ctrl: false,
1480
- cmd: false,
1481
- insertable: false,
1482
- sequence: '\x7f',
1483
- });
1484
- });
1485
- expect(getBufferState(result).text).toBe('');
1486
- });
1487
- it('should only handle Undo if there is something to undo', async () => {
1488
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1489
- // Platform-specific undo key
1490
- const undoKey = process.platform === 'win32'
1491
- ? {
1492
- name: 'z',
1493
- ctrl: true,
1494
- shift: false,
1495
- alt: false,
1496
- cmd: false,
1497
- insertable: false,
1498
- sequence: '\x1a',
1499
- }
1500
- : process.platform === 'darwin'
1501
- ? {
1502
- name: 'z',
1503
- ctrl: false,
1504
- shift: false,
1505
- alt: false,
1506
- cmd: true,
1507
- insertable: false,
1508
- sequence: '\u001b[122;D',
1509
- }
1510
- : {
1511
- name: 'z',
1512
- ctrl: false,
1513
- shift: false,
1514
- alt: true,
1515
- cmd: false,
1516
- insertable: false,
1517
- sequence: '\u001bz',
1518
- };
1519
- // 1. Initial state: nothing to undo
1520
- let handled = true;
1521
- act(() => {
1522
- handled = result.current.handleInput(undoKey);
1523
- });
1524
- expect(handled).toBe(false);
1525
- // 2. Insert something
1526
- act(() => {
1527
- result.current.handleInput({
1528
- name: 'a',
1529
- shift: false,
1530
- alt: false,
1531
- ctrl: false,
1532
- cmd: false,
1533
- insertable: true,
1534
- sequence: 'a',
1535
- });
1536
- });
1537
- expect(getBufferState(result).text).toBe('a');
1538
- // 3. Now undo should work
1539
- act(() => {
1540
- handled = result.current.handleInput(undoKey);
1541
- });
1542
- expect(handled).toBe(true);
1543
- expect(getBufferState(result).text).toBe('');
1544
- // 4. Undo again: nothing left to undo
1545
- act(() => {
1546
- handled = result.current.handleInput(undoKey);
1547
- });
1548
- expect(handled).toBe(false);
1549
- });
1550
- if (process.platform === 'linux') {
1551
- it('should handle "Ctrl+Z" for smart bubbling on Linux/WSL', async () => {
1552
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1553
- const ctrlZ = {
1554
- name: 'z',
1555
- ctrl: true,
1556
- shift: false,
1557
- alt: false,
1558
- cmd: false,
1559
- insertable: false,
1560
- sequence: '\x1a',
1561
- };
1562
- // 1. Empty buffer: should NOT handle (bubble up to Suspend)
1563
- let handled = true;
1564
- act(() => {
1565
- handled = result.current.handleInput(ctrlZ);
1566
- });
1567
- expect(handled).toBe(false);
1568
- // 2. Add text
1569
- act(() => {
1570
- result.current.handleInput({
1571
- name: 'x',
1572
- insertable: true,
1573
- sequence: 'x',
1574
- shift: false,
1575
- alt: false,
1576
- ctrl: false,
1577
- cmd: false,
1578
- });
1579
- });
1580
- // 3. Has history: should handle (perform Undo)
1581
- act(() => {
1582
- handled = result.current.handleInput(ctrlZ);
1583
- });
1584
- expect(handled).toBe(true);
1585
- expect(getBufferState(result).text).toBe('');
1586
- // 4. Empty again: should NOT handle
1587
- act(() => {
1588
- handled = result.current.handleInput(ctrlZ);
1589
- });
1590
- expect(handled).toBe(false);
1591
- });
1592
- }
1593
- it('should only handle Redo if there is something to redo', async () => {
1594
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1595
- // Platform-specific redo key (first in list)
1596
- const redoKey = process.platform === 'win32'
1597
- ? {
1598
- name: 'z',
1599
- ctrl: true,
1600
- shift: true,
1601
- alt: false,
1602
- cmd: false,
1603
- insertable: false,
1604
- sequence: '\x1a',
1605
- }
1606
- : process.platform === 'darwin'
1607
- ? {
1608
- name: 'z',
1609
- ctrl: false,
1610
- shift: true,
1611
- alt: false,
1612
- cmd: true,
1613
- insertable: false,
1614
- sequence: '\u001b[122;2D',
1615
- }
1616
- : {
1617
- name: 'z',
1618
- ctrl: false,
1619
- shift: true,
1620
- alt: true,
1621
- cmd: false,
1622
- insertable: false,
1623
- sequence: '\u001bZ',
1624
- };
1625
- const undoKey = process.platform === 'win32'
1626
- ? {
1627
- name: 'z',
1628
- ctrl: true,
1629
- shift: false,
1630
- alt: false,
1631
- cmd: false,
1632
- insertable: false,
1633
- sequence: '\x1a',
1634
- }
1635
- : process.platform === 'darwin'
1636
- ? {
1637
- name: 'z',
1638
- ctrl: false,
1639
- shift: false,
1640
- alt: false,
1641
- cmd: true,
1642
- insertable: false,
1643
- sequence: '\u001b[122;D',
1644
- }
1645
- : {
1646
- name: 'z',
1647
- ctrl: false,
1648
- shift: false,
1649
- alt: true,
1650
- cmd: false,
1651
- insertable: false,
1652
- sequence: '\u001bz',
1653
- };
1654
- // 1. Initial state: nothing to redo
1655
- let handled = true;
1656
- act(() => {
1657
- handled = result.current.handleInput(redoKey);
1658
- });
1659
- expect(handled).toBe(false);
1660
- // 2. Insert and Undo
1661
- act(() => {
1662
- result.current.handleInput({
1663
- name: 'a',
1664
- shift: false,
1665
- alt: false,
1666
- ctrl: false,
1667
- cmd: false,
1668
- insertable: true,
1669
- sequence: 'a',
1670
- });
1671
- });
1672
- act(() => {
1673
- result.current.handleInput(undoKey);
1674
- });
1675
- expect(getBufferState(result).text).toBe('');
1676
- // 3. Now redo should work
1677
- act(() => {
1678
- handled = result.current.handleInput(redoKey);
1679
- });
1680
- expect(handled).toBe(true);
1681
- expect(getBufferState(result).text).toBe('a');
1682
- // 4. Redo again: nothing left to redo
1683
- act(() => {
1684
- handled = result.current.handleInput(redoKey);
1685
- });
1686
- expect(handled).toBe(false);
1687
- });
1688
- it('should handle multiple delete characters in one input', async () => {
1689
- const { result } = await renderHook(() => useTextBuffer({
1690
- initialText: 'abcde',
1691
- viewport,
1692
- }));
1693
- act(() => result.current.move('end')); // cursor at the end
1694
- expect(getBufferState(result).cursor).toEqual([0, 5]);
1695
- act(() => {
1696
- result.current.handleInput({
1697
- name: 'backspace',
1698
- shift: false,
1699
- alt: false,
1700
- ctrl: false,
1701
- cmd: false,
1702
- insertable: false,
1703
- sequence: '\x7f',
1704
- });
1705
- result.current.handleInput({
1706
- name: 'backspace',
1707
- shift: false,
1708
- alt: false,
1709
- ctrl: false,
1710
- cmd: false,
1711
- insertable: false,
1712
- sequence: '\x7f',
1713
- });
1714
- result.current.handleInput({
1715
- name: 'backspace',
1716
- shift: false,
1717
- alt: false,
1718
- ctrl: false,
1719
- cmd: false,
1720
- insertable: false,
1721
- sequence: '\x7f',
1722
- });
1723
- });
1724
- expect(getBufferState(result).text).toBe('ab');
1725
- expect(getBufferState(result).cursor).toEqual([0, 2]);
1726
- });
1727
- it('should handle inserts that contain delete characters', async () => {
1728
- const { result } = await renderHook(() => useTextBuffer({
1729
- initialText: 'abcde',
1730
- viewport,
1731
- }));
1732
- act(() => result.current.move('end')); // cursor at the end
1733
- expect(getBufferState(result).cursor).toEqual([0, 5]);
1734
- act(() => {
1735
- result.current.insert('\x7f\x7f\x7f');
1736
- });
1737
- expect(getBufferState(result).text).toBe('ab');
1738
- expect(getBufferState(result).cursor).toEqual([0, 2]);
1739
- });
1740
- it('should handle inserts with a mix of regular and delete characters', async () => {
1741
- const { result } = await renderHook(() => useTextBuffer({
1742
- initialText: 'abcde',
1743
- viewport,
1744
- }));
1745
- act(() => result.current.move('end')); // cursor at the end
1746
- expect(getBufferState(result).cursor).toEqual([0, 5]);
1747
- act(() => {
1748
- result.current.insert('\x7fI\x7f\x7fNEW');
1749
- });
1750
- expect(getBufferState(result).text).toBe('abcNEW');
1751
- expect(getBufferState(result).cursor).toEqual([0, 6]);
1752
- });
1753
- it('should handle arrow keys for movement', async () => {
1754
- const { result } = await renderHook(() => useTextBuffer({
1755
- initialText: 'ab',
1756
- viewport,
1757
- }));
1758
- act(() => result.current.move('end')); // cursor [0,2]
1759
- act(() => {
1760
- result.current.handleInput({
1761
- name: 'left',
1762
- shift: false,
1763
- alt: false,
1764
- ctrl: false,
1765
- cmd: false,
1766
- insertable: false,
1767
- sequence: '\x1b[D',
1768
- });
1769
- });
1770
- expect(getBufferState(result).cursor).toEqual([0, 1]);
1771
- act(() => {
1772
- result.current.handleInput({
1773
- name: 'right',
1774
- shift: false,
1775
- alt: false,
1776
- ctrl: false,
1777
- cmd: false,
1778
- insertable: false,
1779
- sequence: '\x1b[C',
1780
- });
1781
- });
1782
- expect(getBufferState(result).cursor).toEqual([0, 2]);
1783
- });
1784
- it('should strip ANSI escape codes when pasting text', async () => {
1785
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1786
- const textWithAnsi = '\x1B[31mHello\x1B[0m \x1B[32mWorld\x1B[0m';
1787
- // Simulate pasting by calling handleInput with a string longer than 1 char
1788
- act(() => {
1789
- result.current.handleInput({
1790
- name: '',
1791
- shift: false,
1792
- alt: false,
1793
- ctrl: false,
1794
- cmd: false,
1795
- insertable: true,
1796
- sequence: textWithAnsi,
1797
- });
1798
- });
1799
- expect(getBufferState(result).text).toBe('Hello World');
1800
- });
1801
- it('should handle VSCode terminal Shift+Enter as newline', async () => {
1802
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1803
- act(() => {
1804
- result.current.handleInput({
1805
- name: 'enter',
1806
- shift: true,
1807
- alt: false,
1808
- ctrl: false,
1809
- cmd: false,
1810
- insertable: true,
1811
- sequence: '\r',
1812
- });
1813
- }); // Simulates Shift+Enter in VSCode terminal
1814
- expect(getBufferState(result).lines).toEqual(['', '']);
1815
- });
1816
- it('should correctly handle repeated pasting of long text', async () => {
1817
- const longText = `not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
1818
-
1819
- Why do we use it?
1820
- It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
1821
-
1822
- Where does it come from?
1823
- Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lore
1824
- `;
1825
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1826
- // Simulate pasting the long text multiple times
1827
- act(() => {
1828
- result.current.insert(longText, { paste: true });
1829
- result.current.insert(longText, { paste: true });
1830
- result.current.insert(longText, { paste: true });
1831
- });
1832
- const state = getBufferState(result);
1833
- // Check that the text is the result of three concatenations of unique placeholders.
1834
- // Now that ID generation is in the reducer, they are correctly unique even when batched.
1835
- expect(state.lines).toStrictEqual([
1836
- '[Pasted Text: 8 lines][Pasted Text: 8 lines #2][Pasted Text: 8 lines #3]',
1837
- ]);
1838
- expect(result.current.pastedContent['[Pasted Text: 8 lines]']).toBe(longText);
1839
- expect(result.current.pastedContent['[Pasted Text: 8 lines #2]']).toBe(longText);
1840
- expect(result.current.pastedContent['[Pasted Text: 8 lines #3]']).toBe(longText);
1841
- const expectedCursorPos = offsetToLogicalPos(state.text, state.text.length);
1842
- expect(state.cursor).toEqual(expectedCursorPos);
1843
- });
1844
- });
1845
- // More tests would be needed for:
1846
- // - setText, replaceRange
1847
- // - deleteWordLeft, deleteWordRight
1848
- // - More complex undo/redo scenarios
1849
- // - Selection and clipboard (copy/paste) - might need clipboard API mocks or internal state check
1850
- // - openInExternalEditor (heavy mocking of fs, child_process, os)
1851
- // - All edge cases for visual scrolling and wrapping with different viewport sizes and text content.
1852
- describe('replaceRange', () => {
1853
- it('should replace a single-line range with single-line text', async () => {
1854
- const { result } = await renderHook(() => useTextBuffer({
1855
- initialText: '@pac',
1856
- viewport,
1857
- }));
1858
- act(() => result.current.replaceRange(0, 1, 0, 4, 'packages'));
1859
- const state = getBufferState(result);
1860
- expect(state.text).toBe('@packages');
1861
- expect(state.cursor).toEqual([0, 9]); // cursor after 'typescript'
1862
- });
1863
- it('should replace a multi-line range with single-line text', async () => {
1864
- const { result } = await renderHook(() => useTextBuffer({
1865
- initialText: 'hello\nworld\nagain',
1866
- viewport,
1867
- }));
1868
- act(() => result.current.replaceRange(0, 2, 1, 3, ' new ')); // replace 'llo\nwor' with ' new '
1869
- const state = getBufferState(result);
1870
- expect(state.text).toBe('he new ld\nagain');
1871
- expect(state.cursor).toEqual([0, 7]); // cursor after ' new '
1872
- });
1873
- it('should delete a range when replacing with an empty string', async () => {
1874
- const { result } = await renderHook(() => useTextBuffer({
1875
- initialText: 'hello world',
1876
- viewport,
1877
- }));
1878
- act(() => result.current.replaceRange(0, 5, 0, 11, '')); // delete ' world'
1879
- const state = getBufferState(result);
1880
- expect(state.text).toBe('hello');
1881
- expect(state.cursor).toEqual([0, 5]);
1882
- });
1883
- it('should handle replacing at the beginning of the text', async () => {
1884
- const { result } = await renderHook(() => useTextBuffer({
1885
- initialText: 'world',
1886
- viewport,
1887
- }));
1888
- act(() => result.current.replaceRange(0, 0, 0, 0, 'hello '));
1889
- const state = getBufferState(result);
1890
- expect(state.text).toBe('hello world');
1891
- expect(state.cursor).toEqual([0, 6]);
1892
- });
1893
- it('should handle replacing at the end of the text', async () => {
1894
- const { result } = await renderHook(() => useTextBuffer({
1895
- initialText: 'hello',
1896
- viewport,
1897
- }));
1898
- act(() => result.current.replaceRange(0, 5, 0, 5, ' world'));
1899
- const state = getBufferState(result);
1900
- expect(state.text).toBe('hello world');
1901
- expect(state.cursor).toEqual([0, 11]);
1902
- });
1903
- it('should handle replacing the entire buffer content', async () => {
1904
- const { result } = await renderHook(() => useTextBuffer({
1905
- initialText: 'old text',
1906
- viewport,
1907
- }));
1908
- act(() => result.current.replaceRange(0, 0, 0, 8, 'new text'));
1909
- const state = getBufferState(result);
1910
- expect(state.text).toBe('new text');
1911
- expect(state.cursor).toEqual([0, 8]);
1912
- });
1913
- it('should correctly replace with unicode characters', async () => {
1914
- const { result } = await renderHook(() => useTextBuffer({
1915
- initialText: 'hello *** world',
1916
- viewport,
1917
- }));
1918
- act(() => result.current.replaceRange(0, 6, 0, 9, '你好'));
1919
- const state = getBufferState(result);
1920
- expect(state.text).toBe('hello 你好 world');
1921
- expect(state.cursor).toEqual([0, 8]); // after '你好'
1922
- });
1923
- it('should handle invalid range by returning false and not changing text', async () => {
1924
- const { result } = await renderHook(() => useTextBuffer({
1925
- initialText: 'test',
1926
- viewport,
1927
- }));
1928
- act(() => {
1929
- result.current.replaceRange(0, 5, 0, 3, 'fail'); // startCol > endCol in same line
1930
- });
1931
- expect(getBufferState(result).text).toBe('test');
1932
- act(() => {
1933
- result.current.replaceRange(1, 0, 0, 0, 'fail'); // startRow > endRow
1934
- });
1935
- expect(getBufferState(result).text).toBe('test');
1936
- });
1937
- it('replaceRange: multiple lines with a single character', async () => {
1938
- const { result } = await renderHook(() => useTextBuffer({
1939
- initialText: 'first\nsecond\nthird',
1940
- viewport,
1941
- }));
1942
- act(() => result.current.replaceRange(0, 2, 2, 3, 'X')); // Replace 'rst\nsecond\nthi'
1943
- const state = getBufferState(result);
1944
- expect(state.text).toBe('fiXrd');
1945
- expect(state.cursor).toEqual([0, 3]); // After 'X'
1946
- });
1947
- it('should replace a single-line range with multi-line text', async () => {
1948
- const { result } = await renderHook(() => useTextBuffer({
1949
- initialText: 'one two three',
1950
- viewport,
1951
- }));
1952
- // Replace "two" with "new\nline"
1953
- act(() => result.current.replaceRange(0, 4, 0, 7, 'new\nline'));
1954
- const state = getBufferState(result);
1955
- expect(state.lines).toEqual(['one new', 'line three']);
1956
- expect(state.text).toBe('one new\nline three');
1957
- expect(state.cursor).toEqual([1, 4]); // cursor after 'line'
1958
- });
1959
- });
1960
- describe('Input Sanitization', () => {
1961
- const createInput = (sequence) => ({
1962
- name: '',
1963
- shift: false,
1964
- alt: false,
1965
- ctrl: false,
1966
- cmd: false,
1967
- insertable: true,
1968
- sequence,
1969
- });
1970
- it.each([
1971
- {
1972
- input: '\x1B[31mHello\x1B[0m \x1B[32mWorld\x1B[0m',
1973
- expected: 'Hello World',
1974
- desc: 'ANSI escape codes',
1975
- },
1976
- {
1977
- input: 'H\x07e\x08l\x0Bl\x0Co',
1978
- expected: 'Hello',
1979
- desc: 'control characters',
1980
- },
1981
- {
1982
- input: '\u001B[4mH\u001B[0mello',
1983
- expected: 'Hello',
1984
- desc: 'mixed ANSI and control characters',
1985
- },
1986
- {
1987
- input: '\u001B[4mPasted\u001B[4m Text',
1988
- expected: 'Pasted Text',
1989
- desc: 'pasted text with ANSI',
1990
- },
1991
- ])('should strip $desc from input', async ({ input, expected }) => {
1992
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
1993
- act(() => {
1994
- result.current.handleInput(createInput(input));
1995
- });
1996
- expect(getBufferState(result).text).toBe(expected);
1997
- });
1998
- it('should not strip standard characters or newlines', async () => {
1999
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
2000
- const validText = 'Hello World\nThis is a test.';
2001
- act(() => {
2002
- result.current.handleInput(createInput(validText));
2003
- });
2004
- expect(getBufferState(result).text).toBe(validText);
2005
- });
2006
- it('should sanitize large text (>5000 chars) and strip unsafe characters', async () => {
2007
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
2008
- const unsafeChars = '\x07\x08\x0B\x0C';
2009
- const largeTextWithUnsafe = 'safe text'.repeat(600) + unsafeChars + 'more safe text';
2010
- expect(largeTextWithUnsafe.length).toBeGreaterThan(5000);
2011
- act(() => {
2012
- result.current.handleInput({
2013
- name: '',
2014
- shift: false,
2015
- alt: false,
2016
- ctrl: false,
2017
- cmd: false,
2018
- insertable: true,
2019
- sequence: largeTextWithUnsafe,
2020
- });
2021
- });
2022
- const resultText = getBufferState(result).text;
2023
- expect(resultText).not.toContain('\x07');
2024
- expect(resultText).not.toContain('\x08');
2025
- expect(resultText).not.toContain('\x0B');
2026
- expect(resultText).not.toContain('\x0C');
2027
- expect(resultText).toContain('safe text');
2028
- expect(resultText).toContain('more safe text');
2029
- });
2030
- it('should sanitize large ANSI text (>5000 chars) and strip escape codes', async () => {
2031
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
2032
- const largeTextWithAnsi = '\x1B[31m' +
2033
- 'red text'.repeat(800) +
2034
- '\x1B[0m' +
2035
- '\x1B[32m' +
2036
- 'green text'.repeat(200) +
2037
- '\x1B[0m';
2038
- expect(largeTextWithAnsi.length).toBeGreaterThan(5000);
2039
- act(() => {
2040
- result.current.handleInput({
2041
- name: '',
2042
- shift: false,
2043
- alt: false,
2044
- ctrl: false,
2045
- cmd: false,
2046
- insertable: true,
2047
- sequence: largeTextWithAnsi,
2048
- });
2049
- });
2050
- const resultText = getBufferState(result).text;
2051
- expect(resultText).not.toContain('\x1B[31m');
2052
- expect(resultText).not.toContain('\x1B[32m');
2053
- expect(resultText).not.toContain('\x1B[0m');
2054
- expect(resultText).toContain('red text');
2055
- expect(resultText).toContain('green text');
2056
- });
2057
- it('should not strip popular emojis', async () => {
2058
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
2059
- const emojis = '🐍🐳🦀🦄';
2060
- act(() => {
2061
- result.current.handleInput({
2062
- name: '',
2063
- shift: false,
2064
- alt: false,
2065
- ctrl: false,
2066
- cmd: false,
2067
- insertable: true,
2068
- sequence: emojis,
2069
- });
2070
- });
2071
- expect(getBufferState(result).text).toBe(emojis);
2072
- });
2073
- });
2074
- describe('inputFilter', () => {
2075
- it('should filter input based on the provided filter function', async () => {
2076
- const { result } = await renderHook(() => useTextBuffer({
2077
- viewport,
2078
- inputFilter: (text) => text.replace(/[^0-9]/g, ''),
2079
- }));
2080
- act(() => result.current.insert('a1b2c3'));
2081
- expect(getBufferState(result).text).toBe('123');
2082
- });
2083
- it('should handle empty result from filter', async () => {
2084
- const { result } = await renderHook(() => useTextBuffer({
2085
- viewport,
2086
- inputFilter: (text) => text.replace(/[^0-9]/g, ''),
2087
- }));
2088
- act(() => result.current.insert('abc'));
2089
- expect(getBufferState(result).text).toBe('');
2090
- });
2091
- it('should filter pasted text', async () => {
2092
- const { result } = await renderHook(() => useTextBuffer({
2093
- viewport,
2094
- inputFilter: (text) => text.toUpperCase(),
2095
- }));
2096
- act(() => result.current.insert('hello', { paste: true }));
2097
- expect(getBufferState(result).text).toBe('HELLO');
2098
- });
2099
- it('should not filter newlines if they are allowed by the filter', async () => {
2100
- const { result } = await renderHook(() => useTextBuffer({
2101
- viewport,
2102
- inputFilter: (text) => text, // Allow everything including newlines
2103
- }));
2104
- act(() => result.current.insert('a\nb'));
2105
- // The insert function splits by newline and inserts separately if it detects them.
2106
- // If the filter allows them, they should be handled correctly by the subsequent logic in insert.
2107
- expect(getBufferState(result).text).toBe('a\nb');
2108
- });
2109
- it('should filter before newline check in insert', async () => {
2110
- const { result } = await renderHook(() => useTextBuffer({
2111
- viewport,
2112
- inputFilter: (text) => text.replace(/\n/g, ''), // Filter out newlines
2113
- }));
2114
- act(() => result.current.insert('a\nb'));
2115
- expect(getBufferState(result).text).toBe('ab');
2116
- });
2117
- });
2118
- describe('stripAnsi', () => {
2119
- it('should correctly strip ANSI escape codes', async () => {
2120
- const textWithAnsi = '\x1B[31mHello\x1B[0m World';
2121
- expect(stripAnsi(textWithAnsi)).toBe('Hello World');
2122
- });
2123
- it('should handle multiple ANSI codes', async () => {
2124
- const textWithMultipleAnsi = '\x1B[1m\x1B[34mBold Blue\x1B[0m Text';
2125
- expect(stripAnsi(textWithMultipleAnsi)).toBe('Bold Blue Text');
2126
- });
2127
- it('should not modify text without ANSI codes', async () => {
2128
- const plainText = 'Plain text';
2129
- expect(stripAnsi(plainText)).toBe('Plain text');
2130
- });
2131
- it('should handle empty string', async () => {
2132
- expect(stripAnsi('')).toBe('');
2133
- });
2134
- });
2135
- describe('Memoization', () => {
2136
- it('should keep action references stable across re-renders', async () => {
2137
- const { result, rerender } = await renderHook(() => useTextBuffer({ viewport }));
2138
- const initialInsert = result.current.insert;
2139
- const initialBackspace = result.current.backspace;
2140
- const initialMove = result.current.move;
2141
- const initialHandleInput = result.current.handleInput;
2142
- rerender();
2143
- expect(result.current.insert).toBe(initialInsert);
2144
- expect(result.current.backspace).toBe(initialBackspace);
2145
- expect(result.current.move).toBe(initialMove);
2146
- expect(result.current.handleInput).toBe(initialHandleInput);
2147
- });
2148
- it('should have memoized actions that operate on the latest state', async () => {
2149
- const { result } = await renderHook(() => useTextBuffer({ viewport }));
2150
- // Store a reference to the memoized insert function.
2151
- const memoizedInsert = result.current.insert;
2152
- // Update the buffer state.
2153
- act(() => {
2154
- result.current.insert('hello');
2155
- });
2156
- expect(getBufferState(result).text).toBe('hello');
2157
- // Now, call the original memoized function reference.
2158
- act(() => {
2159
- memoizedInsert(' world');
2160
- });
2161
- // It should have operated on the updated state.
2162
- expect(getBufferState(result).text).toBe('hello world');
2163
- });
2164
- });
2165
- describe('singleLine mode', () => {
2166
- it('should not insert a newline character when singleLine is true', async () => {
2167
- const { result } = await renderHook(() => useTextBuffer({
2168
- viewport,
2169
- singleLine: true,
2170
- }));
2171
- act(() => result.current.insert('\n'));
2172
- const state = getBufferState(result);
2173
- expect(state.text).toBe('');
2174
- expect(state.lines).toEqual(['']);
2175
- });
2176
- it('should not create a new line when newline() is called and singleLine is true', async () => {
2177
- const { result } = await renderHook(() => useTextBuffer({
2178
- initialText: 'ab',
2179
- viewport,
2180
- singleLine: true,
2181
- }));
2182
- act(() => result.current.move('end')); // cursor at [0,2]
2183
- act(() => result.current.newline());
2184
- const state = getBufferState(result);
2185
- expect(state.text).toBe('ab');
2186
- expect(state.lines).toEqual(['ab']);
2187
- expect(state.cursor).toEqual([0, 2]);
2188
- });
2189
- it('should not handle "Enter" key as newline when singleLine is true', async () => {
2190
- const { result } = await renderHook(() => useTextBuffer({
2191
- viewport,
2192
- singleLine: true,
2193
- }));
2194
- act(() => {
2195
- result.current.handleInput({
2196
- name: 'enter',
2197
- shift: false,
2198
- alt: false,
2199
- ctrl: false,
2200
- cmd: false,
2201
- insertable: true,
2202
- sequence: '\r',
2203
- });
2204
- });
2205
- expect(getBufferState(result).lines).toEqual(['']);
2206
- });
2207
- it('should not print anything for function keys when singleLine is true', async () => {
2208
- const { result } = await renderHook(() => useTextBuffer({
2209
- viewport,
2210
- singleLine: true,
2211
- }));
2212
- act(() => {
2213
- result.current.handleInput({
2214
- name: 'f1',
2215
- shift: false,
2216
- alt: false,
2217
- ctrl: false,
2218
- cmd: false,
2219
- insertable: false,
2220
- sequence: '\u001bOP',
2221
- });
2222
- });
2223
- expect(getBufferState(result).lines).toEqual(['']);
2224
- });
2225
- it('should strip newlines from pasted text when singleLine is true', async () => {
2226
- const { result } = await renderHook(() => useTextBuffer({
2227
- viewport,
2228
- singleLine: true,
2229
- }));
2230
- act(() => result.current.insert('hello\nworld', { paste: true }));
2231
- const state = getBufferState(result);
2232
- expect(state.text).toBe('helloworld');
2233
- expect(state.lines).toEqual(['helloworld']);
2234
- });
2235
- });
2236
- });
2237
- describe('offsetToLogicalPos', () => {
2238
- it.each([
2239
- { text: 'any text', offset: 0, expected: [0, 0], desc: 'offset 0' },
2240
- { text: 'hello', offset: 0, expected: [0, 0], desc: 'single line start' },
2241
- { text: 'hello', offset: 2, expected: [0, 2], desc: 'single line middle' },
2242
- { text: 'hello', offset: 5, expected: [0, 5], desc: 'single line end' },
2243
- { text: 'hello', offset: 10, expected: [0, 5], desc: 'beyond end clamps' },
2244
- {
2245
- text: 'a\n\nc',
2246
- offset: 0,
2247
- expected: [0, 0],
2248
- desc: 'empty lines - first char',
2249
- },
2250
- {
2251
- text: 'a\n\nc',
2252
- offset: 1,
2253
- expected: [0, 1],
2254
- desc: 'empty lines - end of first',
2255
- },
2256
- {
2257
- text: 'a\n\nc',
2258
- offset: 2,
2259
- expected: [1, 0],
2260
- desc: 'empty lines - empty line',
2261
- },
2262
- {
2263
- text: 'a\n\nc',
2264
- offset: 3,
2265
- expected: [2, 0],
2266
- desc: 'empty lines - last line start',
2267
- },
2268
- {
2269
- text: 'a\n\nc',
2270
- offset: 4,
2271
- expected: [2, 1],
2272
- desc: 'empty lines - last line end',
2273
- },
2274
- {
2275
- text: 'hello\n',
2276
- offset: 5,
2277
- expected: [0, 5],
2278
- desc: 'newline end - before newline',
2279
- },
2280
- {
2281
- text: 'hello\n',
2282
- offset: 6,
2283
- expected: [1, 0],
2284
- desc: 'newline end - after newline',
2285
- },
2286
- {
2287
- text: 'hello\n',
2288
- offset: 7,
2289
- expected: [1, 0],
2290
- desc: 'newline end - beyond',
2291
- },
2292
- {
2293
- text: '\nhello',
2294
- offset: 0,
2295
- expected: [0, 0],
2296
- desc: 'newline start - first line',
2297
- },
2298
- {
2299
- text: '\nhello',
2300
- offset: 1,
2301
- expected: [1, 0],
2302
- desc: 'newline start - second line',
2303
- },
2304
- {
2305
- text: '\nhello',
2306
- offset: 3,
2307
- expected: [1, 2],
2308
- desc: 'newline start - middle of second',
2309
- },
2310
- { text: '', offset: 0, expected: [0, 0], desc: 'empty string at 0' },
2311
- { text: '', offset: 5, expected: [0, 0], desc: 'empty string beyond' },
2312
- {
2313
- text: '你好\n世界',
2314
- offset: 0,
2315
- expected: [0, 0],
2316
- desc: 'unicode - start',
2317
- },
2318
- {
2319
- text: '你好\n世界',
2320
- offset: 1,
2321
- expected: [0, 1],
2322
- desc: 'unicode - after first char',
2323
- },
2324
- {
2325
- text: '你好\n世界',
2326
- offset: 2,
2327
- expected: [0, 2],
2328
- desc: 'unicode - end first line',
2329
- },
2330
- {
2331
- text: '你好\n世界',
2332
- offset: 3,
2333
- expected: [1, 0],
2334
- desc: 'unicode - second line start',
2335
- },
2336
- {
2337
- text: '你好\n世界',
2338
- offset: 4,
2339
- expected: [1, 1],
2340
- desc: 'unicode - second line middle',
2341
- },
2342
- {
2343
- text: '你好\n世界',
2344
- offset: 5,
2345
- expected: [1, 2],
2346
- desc: 'unicode - second line end',
2347
- },
2348
- {
2349
- text: '你好\n世界',
2350
- offset: 6,
2351
- expected: [1, 2],
2352
- desc: 'unicode - beyond',
2353
- },
2354
- {
2355
- text: 'abc\ndef',
2356
- offset: 3,
2357
- expected: [0, 3],
2358
- desc: 'at newline - end of line',
2359
- },
2360
- {
2361
- text: 'abc\ndef',
2362
- offset: 4,
2363
- expected: [1, 0],
2364
- desc: 'at newline - after newline',
2365
- },
2366
- { text: '🐶🐱', offset: 0, expected: [0, 0], desc: 'emoji - start' },
2367
- { text: '🐶🐱', offset: 1, expected: [0, 1], desc: 'emoji - middle' },
2368
- { text: '🐶🐱', offset: 2, expected: [0, 2], desc: 'emoji - end' },
2369
- ])('should handle $desc', async ({ text, offset, expected }) => {
2370
- expect(offsetToLogicalPos(text, offset)).toEqual(expected);
2371
- });
2372
- describe('multi-line text', () => {
2373
- const text = 'hello\nworld\n123';
2374
- it.each([
2375
- { offset: 0, expected: [0, 0], desc: 'start of first line' },
2376
- { offset: 3, expected: [0, 3], desc: 'middle of first line' },
2377
- { offset: 5, expected: [0, 5], desc: 'end of first line' },
2378
- { offset: 6, expected: [1, 0], desc: 'start of second line' },
2379
- { offset: 8, expected: [1, 2], desc: 'middle of second line' },
2380
- { offset: 11, expected: [1, 5], desc: 'end of second line' },
2381
- { offset: 12, expected: [2, 0], desc: 'start of third line' },
2382
- { offset: 13, expected: [2, 1], desc: 'middle of third line' },
2383
- { offset: 15, expected: [2, 3], desc: 'end of third line' },
2384
- { offset: 20, expected: [2, 3], desc: 'beyond end' },
2385
- ])('should return $expected for $desc (offset $offset)', ({ offset, expected }) => {
2386
- expect(offsetToLogicalPos(text, offset)).toEqual(expected);
2387
- });
2388
- });
2389
- });
2390
- describe('logicalPosToOffset', () => {
2391
- it('should convert row/col position to offset correctly', async () => {
2392
- const lines = ['hello', 'world', '123'];
2393
- // Line 0: "hello" (5 chars)
2394
- expect(logicalPosToOffset(lines, 0, 0)).toBe(0); // Start of 'hello'
2395
- expect(logicalPosToOffset(lines, 0, 3)).toBe(3); // 'l' in 'hello'
2396
- expect(logicalPosToOffset(lines, 0, 5)).toBe(5); // End of 'hello'
2397
- // Line 1: "world" (5 chars), offset starts at 6 (5 + 1 for newline)
2398
- expect(logicalPosToOffset(lines, 1, 0)).toBe(6); // Start of 'world'
2399
- expect(logicalPosToOffset(lines, 1, 2)).toBe(8); // 'r' in 'world'
2400
- expect(logicalPosToOffset(lines, 1, 5)).toBe(11); // End of 'world'
2401
- // Line 2: "123" (3 chars), offset starts at 12 (5 + 1 + 5 + 1)
2402
- expect(logicalPosToOffset(lines, 2, 0)).toBe(12); // Start of '123'
2403
- expect(logicalPosToOffset(lines, 2, 1)).toBe(13); // '2' in '123'
2404
- expect(logicalPosToOffset(lines, 2, 3)).toBe(15); // End of '123'
2405
- });
2406
- it('should handle empty lines', async () => {
2407
- const lines = ['a', '', 'c'];
2408
- expect(logicalPosToOffset(lines, 0, 0)).toBe(0); // 'a'
2409
- expect(logicalPosToOffset(lines, 0, 1)).toBe(1); // End of 'a'
2410
- expect(logicalPosToOffset(lines, 1, 0)).toBe(2); // Empty line
2411
- expect(logicalPosToOffset(lines, 2, 0)).toBe(3); // 'c'
2412
- expect(logicalPosToOffset(lines, 2, 1)).toBe(4); // End of 'c'
2413
- });
2414
- it('should handle single empty line', async () => {
2415
- const lines = [''];
2416
- expect(logicalPosToOffset(lines, 0, 0)).toBe(0);
2417
- });
2418
- it('should be inverse of offsetToLogicalPos', async () => {
2419
- const lines = ['hello', 'world', '123'];
2420
- const text = lines.join('\n');
2421
- // Test round-trip conversion
2422
- for (let offset = 0; offset <= text.length; offset++) {
2423
- const [row, col] = offsetToLogicalPos(text, offset);
2424
- const convertedOffset = logicalPosToOffset(lines, row, col);
2425
- expect(convertedOffset).toBe(offset);
2426
- }
2427
- });
2428
- it('should handle out-of-bounds positions', async () => {
2429
- const lines = ['hello'];
2430
- // Beyond end of line
2431
- expect(logicalPosToOffset(lines, 0, 10)).toBe(5); // Clamps to end of line
2432
- // Beyond array bounds - should clamp to the last line
2433
- expect(logicalPosToOffset(lines, 5, 0)).toBe(0); // Clamps to start of last line (row 0)
2434
- expect(logicalPosToOffset(lines, 5, 10)).toBe(5); // Clamps to end of last line
2435
- });
2436
- });
2437
- const createTestState = (lines, cursorRow, cursorCol, viewportWidth = 80) => {
2438
- const text = lines.join('\n');
2439
- let state = textBufferReducer(initialState, {
2440
- type: 'set_text',
2441
- payload: text,
2442
- });
2443
- state = textBufferReducer(state, {
2444
- type: 'set_cursor',
2445
- payload: { cursorRow, cursorCol, preferredCol: null },
2446
- });
2447
- state = textBufferReducer(state, {
2448
- type: 'set_viewport',
2449
- payload: { width: viewportWidth, height: 24 },
2450
- });
2451
- return state;
2452
- };
2453
- describe('textBufferReducer vim operations', () => {
2454
- describe('vim_delete_line', () => {
2455
- it('should delete a single line including newline in multi-line text', async () => {
2456
- const state = createTestState(['line1', 'line2', 'line3'], 1, 2);
2457
- const action = {
2458
- type: 'vim_delete_line',
2459
- payload: { count: 1 },
2460
- };
2461
- const result = textBufferReducer(state, action);
2462
- expect(result).toHaveOnlyValidCharacters();
2463
- // After deleting line2, we should have line1 and line3, with cursor on line3 (now at index 1)
2464
- expect(result.lines).toEqual(['line1', 'line3']);
2465
- expect(result.cursorRow).toBe(1);
2466
- expect(result.cursorCol).toBe(0);
2467
- });
2468
- it('should delete multiple lines when count > 1', async () => {
2469
- const state = createTestState(['line1', 'line2', 'line3', 'line4'], 1, 0);
2470
- const action = {
2471
- type: 'vim_delete_line',
2472
- payload: { count: 2 },
2473
- };
2474
- const result = textBufferReducer(state, action);
2475
- expect(result).toHaveOnlyValidCharacters();
2476
- // Should delete line2 and line3, leaving line1 and line4
2477
- expect(result.lines).toEqual(['line1', 'line4']);
2478
- expect(result.cursorRow).toBe(1);
2479
- expect(result.cursorCol).toBe(0);
2480
- });
2481
- it('should clear single line content when only one line exists', async () => {
2482
- const state = createTestState(['only line'], 0, 5);
2483
- const action = {
2484
- type: 'vim_delete_line',
2485
- payload: { count: 1 },
2486
- };
2487
- const result = textBufferReducer(state, action);
2488
- expect(result).toHaveOnlyValidCharacters();
2489
- // Should clear the line content but keep the line
2490
- expect(result.lines).toEqual(['']);
2491
- expect(result.cursorRow).toBe(0);
2492
- expect(result.cursorCol).toBe(0);
2493
- });
2494
- it('should handle deleting the last line properly', async () => {
2495
- const state = createTestState(['line1', 'line2'], 1, 0);
2496
- const action = {
2497
- type: 'vim_delete_line',
2498
- payload: { count: 1 },
2499
- };
2500
- const result = textBufferReducer(state, action);
2501
- expect(result).toHaveOnlyValidCharacters();
2502
- // Should delete the last line completely, not leave empty line
2503
- expect(result.lines).toEqual(['line1']);
2504
- expect(result.cursorRow).toBe(0);
2505
- expect(result.cursorCol).toBe(0);
2506
- });
2507
- it('should handle deleting all lines and maintain valid state for subsequent paste', async () => {
2508
- const state = createTestState(['line1', 'line2', 'line3', 'line4'], 0, 0);
2509
- // Delete all 4 lines with 4dd
2510
- const deleteAction = {
2511
- type: 'vim_delete_line',
2512
- payload: { count: 4 },
2513
- };
2514
- const afterDelete = textBufferReducer(state, deleteAction);
2515
- expect(afterDelete).toHaveOnlyValidCharacters();
2516
- // After deleting all lines, should have one empty line
2517
- expect(afterDelete.lines).toEqual(['']);
2518
- expect(afterDelete.cursorRow).toBe(0);
2519
- expect(afterDelete.cursorCol).toBe(0);
2520
- // Now paste multiline content - this should work correctly
2521
- const pasteAction = {
2522
- type: 'insert',
2523
- payload: 'new1\nnew2\nnew3\nnew4',
2524
- };
2525
- const afterPaste = textBufferReducer(afterDelete, pasteAction);
2526
- expect(afterPaste).toHaveOnlyValidCharacters();
2527
- // All lines including the first one should be present
2528
- expect(afterPaste.lines).toEqual(['new1', 'new2', 'new3', 'new4']);
2529
- expect(afterPaste.cursorRow).toBe(3);
2530
- expect(afterPaste.cursorCol).toBe(4);
2531
- });
2532
- });
2533
- });
2534
- describe('Unicode helper functions', () => {
2535
- describe('findWordEndInLine with Unicode', () => {
2536
- it('should handle combining characters', async () => {
2537
- // café with combining accent
2538
- const cafeWithCombining = 'cafe\u0301';
2539
- const result = findWordEndInLine(cafeWithCombining + ' test', 0);
2540
- expect(result).toBe(3); // End of 'café' at base character 'e', not combining accent
2541
- });
2542
- it('should handle precomposed characters with diacritics', async () => {
2543
- // café with precomposed é (U+00E9)
2544
- const cafePrecomposed = 'café';
2545
- const result = findWordEndInLine(cafePrecomposed + ' test', 0);
2546
- expect(result).toBe(3); // End of 'café' at precomposed character 'é'
2547
- });
2548
- it('should return null when no word end found', async () => {
2549
- const result = findWordEndInLine(' ', 0);
2550
- expect(result).toBeNull(); // No word end found in whitespace-only string string
2551
- });
2552
- });
2553
- describe('findNextWordStartInLine with Unicode', () => {
2554
- it('should handle right-to-left text', async () => {
2555
- const result = findNextWordStartInLine('hello مرحبا world', 0);
2556
- expect(result).toBe(6); // Start of Arabic word
2557
- });
2558
- it('should handle Chinese characters', async () => {
2559
- const result = findNextWordStartInLine('hello 你好 world', 0);
2560
- expect(result).toBe(6); // Start of Chinese word
2561
- });
2562
- it('should return null at end of line', async () => {
2563
- const result = findNextWordStartInLine('hello', 10);
2564
- expect(result).toBeNull();
2565
- });
2566
- it('should handle combining characters', async () => {
2567
- // café with combining accent + next word
2568
- const textWithCombining = 'cafe\u0301 test';
2569
- const result = findNextWordStartInLine(textWithCombining, 0);
2570
- expect(result).toBe(6); // Start of 'test' after 'café ' (combining char makes string longer)
2571
- });
2572
- it('should handle precomposed characters with diacritics', async () => {
2573
- // café with precomposed é + next word
2574
- const textPrecomposed = 'café test';
2575
- const result = findNextWordStartInLine(textPrecomposed, 0);
2576
- expect(result).toBe(5); // Start of 'test' after 'café '
2577
- });
2578
- });
2579
- describe('isWordCharStrict with Unicode', () => {
2580
- it('should return true for ASCII word characters', async () => {
2581
- expect(isWordCharStrict('a')).toBe(true);
2582
- expect(isWordCharStrict('Z')).toBe(true);
2583
- expect(isWordCharStrict('0')).toBe(true);
2584
- expect(isWordCharStrict('_')).toBe(true);
2585
- });
2586
- it('should return false for punctuation', async () => {
2587
- expect(isWordCharStrict('.')).toBe(false);
2588
- expect(isWordCharStrict(',')).toBe(false);
2589
- expect(isWordCharStrict('!')).toBe(false);
2590
- });
2591
- it('should return true for non-Latin scripts', async () => {
2592
- expect(isWordCharStrict('你')).toBe(true); // Chinese character
2593
- expect(isWordCharStrict('م')).toBe(true); // Arabic character
2594
- });
2595
- it('should return false for whitespace', async () => {
2596
- expect(isWordCharStrict(' ')).toBe(false);
2597
- expect(isWordCharStrict('\t')).toBe(false);
2598
- });
2599
- });
2600
- describe('cpLen with Unicode', () => {
2601
- it('should handle combining characters', async () => {
2602
- expect(cpLen('é')).toBe(1); // Precomposed
2603
- expect(cpLen('e\u0301')).toBe(2); // e + combining acute
2604
- });
2605
- it('should handle Chinese and Arabic text', async () => {
2606
- expect(cpLen('hello 你好 world')).toBe(14); // 5 + 1 + 2 + 1 + 5 = 14
2607
- expect(cpLen('hello مرحبا world')).toBe(17);
2608
- });
2609
- });
2610
- describe('useTextBuffer CJK Navigation', () => {
2611
- const viewport = { width: 80, height: 24 };
2612
- it('should navigate by word in Chinese', async () => {
2613
- const { result } = await renderHook(() => useTextBuffer({
2614
- initialText: '你好世界',
2615
- initialCursorOffset: 4, // End of string
2616
- viewport,
2617
- }));
2618
- // Initial state: cursor at end (index 2 in code points if 4 is length? wait. length is 2 code points? No. '你好世界' length is 4.)
2619
- // '你好世界' length is 4. Code points length is 4.
2620
- // Move word left
2621
- act(() => {
2622
- result.current.move('wordLeft');
2623
- });
2624
- // Should be at start of "世界" (index 2)
2625
- // "你好世界" -> "你好" | "世界"
2626
- expect(result.current.cursor[1]).toBe(2);
2627
- // Move word left again
2628
- act(() => {
2629
- result.current.move('wordLeft');
2630
- });
2631
- // Should be at start of "你好" (index 0)
2632
- expect(result.current.cursor[1]).toBe(0);
2633
- // Move word left again (should stay at 0)
2634
- act(() => {
2635
- result.current.move('wordLeft');
2636
- });
2637
- expect(result.current.cursor[1]).toBe(0);
2638
- // Move word right
2639
- act(() => {
2640
- result.current.move('wordRight');
2641
- });
2642
- // Should be at end of "你好" (index 2)
2643
- expect(result.current.cursor[1]).toBe(2);
2644
- // Move word right again
2645
- act(() => {
2646
- result.current.move('wordRight');
2647
- });
2648
- // Should be at end of "世界" (index 4)
2649
- expect(result.current.cursor[1]).toBe(4);
2650
- // Move word right again (should stay at end)
2651
- act(() => {
2652
- result.current.move('wordRight');
2653
- });
2654
- expect(result.current.cursor[1]).toBe(4);
2655
- });
2656
- it('should navigate mixed English and Chinese', async () => {
2657
- const { result } = await renderHook(() => useTextBuffer({
2658
- initialText: 'Hello你好World',
2659
- initialCursorOffset: 10, // End
2660
- viewport,
2661
- }));
2662
- // Hello (5) + 你好 (2) + World (5) = 12 chars.
2663
- // initialCursorOffset 10? 'Hello你好World'.length is 12.
2664
- // Let's set it to end.
2665
- act(() => {
2666
- result.current.move('end');
2667
- });
2668
- expect(result.current.cursor[1]).toBe(12);
2669
- // wordLeft -> start of "World" (index 7)
2670
- act(() => result.current.move('wordLeft'));
2671
- expect(result.current.cursor[1]).toBe(7);
2672
- // wordLeft -> start of "你好" (index 5)
2673
- act(() => result.current.move('wordLeft'));
2674
- expect(result.current.cursor[1]).toBe(5);
2675
- // wordLeft -> start of "Hello" (index 0)
2676
- act(() => result.current.move('wordLeft'));
2677
- expect(result.current.cursor[1]).toBe(0);
2678
- // wordLeft -> start of line (should stay at 0)
2679
- act(() => result.current.move('wordLeft'));
2680
- expect(result.current.cursor[1]).toBe(0);
2681
- });
2682
- });
2683
- });
2684
- const mockPlatform = (platform) => {
2685
- vi.stubGlobal('process', Object.create(process, {
2686
- platform: {
2687
- get: () => platform,
2688
- },
2689
- }));
2690
- };
2691
- describe('Transformation Utilities', () => {
2692
- afterEach(() => {
2693
- vi.restoreAllMocks();
2694
- vi.unstubAllGlobals();
2695
- });
2696
- describe('getTransformedImagePath', () => {
2697
- beforeEach(() => mockPlatform('linux'));
2698
- it('should transform a simple image path', async () => {
2699
- expect(getTransformedImagePath('@test.png')).toBe('[Image test.png]');
2700
- });
2701
- it('should handle paths with directories', async () => {
2702
- expect(getTransformedImagePath('@path/to/image.jpg')).toBe('[Image image.jpg]');
2703
- });
2704
- it('should truncate long filenames', async () => {
2705
- expect(getTransformedImagePath('@verylongfilename1234567890.png')).toBe('[Image ...1234567890.png]');
2706
- });
2707
- it('should handle different image extensions', async () => {
2708
- expect(getTransformedImagePath('@test.jpg')).toBe('[Image test.jpg]');
2709
- expect(getTransformedImagePath('@test.jpeg')).toBe('[Image test.jpeg]');
2710
- expect(getTransformedImagePath('@test.gif')).toBe('[Image test.gif]');
2711
- expect(getTransformedImagePath('@test.webp')).toBe('[Image test.webp]');
2712
- expect(getTransformedImagePath('@test.svg')).toBe('[Image test.svg]');
2713
- expect(getTransformedImagePath('@test.bmp')).toBe('[Image test.bmp]');
2714
- });
2715
- it('should handle POSIX-style forward-slash paths on any platform', async () => {
2716
- const input = '@C:/Users/foo/screenshots/image2x.png';
2717
- expect(getTransformedImagePath(input)).toBe('[Image image2x.png]');
2718
- });
2719
- it('should handle escaped spaces in paths', async () => {
2720
- const input = '@path/to/my\\ file.png';
2721
- expect(getTransformedImagePath(input)).toBe('[Image my file.png]');
2722
- });
2723
- });
2724
- describe('getTransformationsForLine', () => {
2725
- it('should find transformations in a line', async () => {
2726
- const line = 'Check out @test.png and @another.jpg';
2727
- const result = calculateTransformationsForLine(line);
2728
- expect(result).toHaveLength(2);
2729
- expect(result[0]).toMatchObject({
2730
- logicalText: '@test.png',
2731
- collapsedText: '[Image test.png]',
2732
- });
2733
- expect(result[1]).toMatchObject({
2734
- logicalText: '@another.jpg',
2735
- collapsedText: '[Image another.jpg]',
2736
- });
2737
- });
2738
- it('should handle no transformations', async () => {
2739
- const line = 'Just some regular text';
2740
- const result = calculateTransformationsForLine(line);
2741
- expect(result).toEqual([]);
2742
- });
2743
- it('should handle empty line', async () => {
2744
- const result = calculateTransformationsForLine('');
2745
- expect(result).toEqual([]);
2746
- });
2747
- it('should keep adjacent image paths as separate transformations', async () => {
2748
- const line = '@a.png@b.png@c.png';
2749
- const result = calculateTransformationsForLine(line);
2750
- expect(result).toHaveLength(3);
2751
- expect(result[0].logicalText).toBe('@a.png');
2752
- expect(result[1].logicalText).toBe('@b.png');
2753
- expect(result[2].logicalText).toBe('@c.png');
2754
- });
2755
- it('should handle multiple transformations in a row', async () => {
2756
- const line = '@a.png @b.png @c.png';
2757
- const result = calculateTransformationsForLine(line);
2758
- expect(result).toHaveLength(3);
2759
- });
2760
- });
2761
- describe('getTransformUnderCursor', () => {
2762
- const transformations = [
2763
- {
2764
- logStart: 5,
2765
- logEnd: 14,
2766
- logicalText: '@test.png',
2767
- collapsedText: '[Image @test.png]',
2768
- type: 'image',
2769
- },
2770
- {
2771
- logStart: 20,
2772
- logEnd: 31,
2773
- logicalText: '@another.jpg',
2774
- collapsedText: '[Image @another.jpg]',
2775
- type: 'image',
2776
- },
2777
- ];
2778
- it('should find transformation when cursor is inside it', async () => {
2779
- const result = getTransformUnderCursor(0, 7, [transformations]);
2780
- expect(result).toEqual(transformations[0]);
2781
- });
2782
- it('should find transformation when cursor is at start', async () => {
2783
- const result = getTransformUnderCursor(0, 5, [transformations]);
2784
- expect(result).toEqual(transformations[0]);
2785
- });
2786
- it('should NOT find transformation when cursor is at end', async () => {
2787
- const result = getTransformUnderCursor(0, 14, [transformations]);
2788
- expect(result).toBeNull();
2789
- });
2790
- it('should return null when cursor is not on a transformation', async () => {
2791
- const result = getTransformUnderCursor(0, 2, [transformations]);
2792
- expect(result).toBeNull();
2793
- });
2794
- it('should handle empty transformations array', async () => {
2795
- const result = getTransformUnderCursor(0, 5, []);
2796
- expect(result).toBeNull();
2797
- });
2798
- it('regression: should not find paste transformation when clicking one character after it', async () => {
2799
- const pasteId = '[Pasted Text: 5 lines]';
2800
- const line = pasteId + ' suffix';
2801
- const transformations = calculateTransformationsForLine(line);
2802
- const pasteTransform = transformations.find((t) => t.type === 'paste');
2803
- expect(pasteTransform).toBeDefined();
2804
- const endPos = pasteTransform.logEnd;
2805
- // Position strictly at end should be null
2806
- expect(getTransformUnderCursor(0, endPos, [transformations])).toBeNull();
2807
- // Position inside should be found
2808
- expect(getTransformUnderCursor(0, endPos - 1, [transformations])).toEqual(pasteTransform);
2809
- });
2810
- });
2811
- describe('calculateTransformedLine', () => {
2812
- it('should transform a line with one transformation', async () => {
2813
- const line = 'Check out @test.png';
2814
- const transformations = calculateTransformationsForLine(line);
2815
- const result = calculateTransformedLine(line, 0, [0, 0], transformations);
2816
- expect(result.transformedLine).toBe('Check out [Image test.png]');
2817
- expect(result.transformedToLogMap).toHaveLength(27); // Length includes all characters in the transformed line
2818
- // Test that we have proper mappings
2819
- expect(result.transformedToLogMap[0]).toBe(0); // 'C'
2820
- expect(result.transformedToLogMap[9]).toBe(9); // ' ' before transformation
2821
- });
2822
- it('should handle cursor inside transformation', async () => {
2823
- const line = 'Check out @test.png';
2824
- const transformations = calculateTransformationsForLine(line);
2825
- // Cursor at '@' (position 10 in the line)
2826
- const result = calculateTransformedLine(line, 0, [0, 10], transformations);
2827
- // Should show full path when cursor is on it
2828
- expect(result.transformedLine).toBe('Check out @test.png');
2829
- // When expanded, each character maps to itself
2830
- expect(result.transformedToLogMap[10]).toBe(10); // '@'
2831
- });
2832
- it('should handle line with no transformations', async () => {
2833
- const line = 'Just some text';
2834
- const result = calculateTransformedLine(line, 0, [0, 0], []);
2835
- expect(result.transformedLine).toBe(line);
2836
- // Each visual position should map directly to logical position + trailing
2837
- expect(result.transformedToLogMap).toHaveLength(15); // 14 chars + 1 trailing
2838
- expect(result.transformedToLogMap[0]).toBe(0);
2839
- expect(result.transformedToLogMap[13]).toBe(13);
2840
- expect(result.transformedToLogMap[14]).toBe(14); // Trailing position
2841
- });
2842
- it('should handle empty line', async () => {
2843
- const result = calculateTransformedLine('', 0, [0, 0], []);
2844
- expect(result.transformedLine).toBe('');
2845
- expect(result.transformedToLogMap).toEqual([0]); // Just the trailing position
2846
- });
2847
- });
2848
- describe('Layout Caching and Invalidation', () => {
2849
- it.each([
2850
- {
2851
- desc: 'via setText',
2852
- actFn: (result) => result.current.setText('changed line'),
2853
- expected: 'changed line',
2854
- },
2855
- {
2856
- desc: 'via replaceRange',
2857
- actFn: (result) => result.current.replaceRange(0, 0, 0, 13, 'changed line'),
2858
- expected: 'changed line',
2859
- },
2860
- ])('should invalidate cache when line content changes $desc', async ({ actFn, expected }) => {
2861
- const viewport = { width: 80, height: 24 };
2862
- const { result } = await renderHookWithProviders(() => useTextBuffer({
2863
- initialText: 'original line',
2864
- viewport,
2865
- escapePastedPaths: true,
2866
- }));
2867
- const originalLayout = result.current.visualLayout;
2868
- act(() => {
2869
- actFn(result);
2870
- });
2871
- expect(result.current.visualLayout).not.toBe(originalLayout);
2872
- expect(result.current.allVisualLines[0]).toBe(expected);
2873
- });
2874
- it('should invalidate cache when viewport width changes', async () => {
2875
- const viewport = { width: 80, height: 24 };
2876
- const { result, rerender } = await renderHookWithProviders(({ vp }) => useTextBuffer({
2877
- initialText: 'a very long line that will wrap when the viewport is small',
2878
- viewport: vp,
2879
- escapePastedPaths: true,
2880
- }), { initialProps: { vp: viewport } });
2881
- const originalLayout = result.current.visualLayout;
2882
- // Shrink viewport to force wrapping change
2883
- rerender({ vp: { width: 10, height: 24 } });
2884
- expect(result.current.visualLayout).not.toBe(originalLayout);
2885
- expect(result.current.allVisualLines.length).toBeGreaterThan(1);
2886
- });
2887
- it('should correctly handle cursor expansion/collapse in cached layout', async () => {
2888
- const viewport = { width: 80, height: 24 };
2889
- const text = 'Check @image.png here';
2890
- const { result } = await renderHookWithProviders(() => useTextBuffer({
2891
- initialText: text,
2892
- viewport,
2893
- escapePastedPaths: true,
2894
- }));
2895
- // Cursor at start (collapsed)
2896
- act(() => {
2897
- result.current.moveToOffset(0);
2898
- });
2899
- expect(result.current.allVisualLines[0]).toContain('[Image image.png]');
2900
- // Move cursor onto the @path (expanded)
2901
- act(() => {
2902
- result.current.moveToOffset(7); // onto @
2903
- });
2904
- expect(result.current.allVisualLines[0]).toContain('@image.png');
2905
- expect(result.current.allVisualLines[0]).not.toContain('[Image image.png]');
2906
- // Move cursor away (collapsed again)
2907
- act(() => {
2908
- result.current.moveToOffset(0);
2909
- });
2910
- expect(result.current.allVisualLines[0]).toContain('[Image image.png]');
2911
- });
2912
- it('should reuse cache for unchanged lines during editing', async () => {
2913
- const viewport = { width: 80, height: 24 };
2914
- const initialText = 'line 1\nline 2\nline 3';
2915
- const { result } = await renderHookWithProviders(() => useTextBuffer({
2916
- initialText,
2917
- viewport,
2918
- escapePastedPaths: true,
2919
- }));
2920
- const layout1 = result.current.visualLayout;
2921
- // Edit line 1
2922
- act(() => {
2923
- result.current.moveToOffset(0);
2924
- result.current.insert('X');
2925
- });
2926
- const layout2 = result.current.visualLayout;
2927
- expect(layout2).not.toBe(layout1);
2928
- // Verify that visual lines for line 2 and 3 (indices 1 and 2 in visualLines)
2929
- // are identical in content if not in object reference (the arrays are rebuilt, but contents are cached)
2930
- expect(result.current.allVisualLines[1]).toBe('line 2');
2931
- expect(result.current.allVisualLines[2]).toBe('line 3');
2932
- });
2933
- });
2934
- describe('Scroll Regressions', () => {
2935
- const scrollViewport = { width: 80, height: 5 };
2936
- it('should not show empty viewport when collapsing a large paste that was scrolled', async () => {
2937
- const largeContent = 'line1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\nline9\nline10';
2938
- const placeholder = '[Pasted Text: 10 lines]';
2939
- const { result } = await renderHook(() => useTextBuffer({
2940
- initialText: placeholder,
2941
- viewport: scrollViewport,
2942
- }));
2943
- // Setup: paste large content
2944
- act(() => {
2945
- result.current.setText('');
2946
- result.current.insert(largeContent, { paste: true });
2947
- });
2948
- // Expand it
2949
- act(() => {
2950
- result.current.togglePasteExpansion(placeholder, 0, 0);
2951
- });
2952
- // Verify scrolled state
2953
- expect(result.current.visualScrollRow).toBe(5);
2954
- // Collapse it
2955
- act(() => {
2956
- result.current.togglePasteExpansion(placeholder, 9, 0);
2957
- });
2958
- // Verify viewport is NOT empty immediately (clamping in useMemo)
2959
- expect(result.current.allVisualLines.length).toBe(1);
2960
- expect(result.current.viewportVisualLines.length).toBe(1);
2961
- expect(result.current.viewportVisualLines[0]).toBe(placeholder);
2962
- });
2963
- });
2964
- });
2965
- //# sourceMappingURL=text-buffer.test.js.map