@gloom-sh/terminal 0.20.10 → 0.20.12

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 (324) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
  3. package/src/api-client/awards.ts +16 -0
  4. package/src/api-client/central-bank-rates.ts +5 -0
  5. package/src/api-client/data.ts +55 -2
  6. package/src/api-client/index.ts +18 -1
  7. package/src/api-client/request.ts +86 -3
  8. package/src/api-client/socket-connection.ts +366 -0
  9. package/src/api-client/socket-features.ts +75 -0
  10. package/src/api-client/socket-frames.ts +161 -0
  11. package/src/api-client/socket-listeners.ts +207 -0
  12. package/src/api-client/socket-quotes.ts +332 -0
  13. package/src/api-client/socket.ts +168 -983
  14. package/src/api-client/supply-chain-graph.ts +4 -2
  15. package/src/api-client/supply-chain.ts +8 -0
  16. package/src/api-client/types/econ.ts +10 -7
  17. package/src/api-client/types/filings-and-calls.ts +8 -0
  18. package/src/app/global-shortcuts.ts +2 -1
  19. package/src/app/keybindings/actions.ts +19 -0
  20. package/src/app/pane-runtime/index.tsx +18 -3
  21. package/src/app/pane-runtime/layout-placement.ts +63 -0
  22. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  23. package/src/brokers/signed-in/adapter.ts +19 -5
  24. package/src/brokers/signed-in/client.ts +13 -1
  25. package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
  26. package/src/capabilities/chart-series.ts +4 -1
  27. package/src/cli/board-coins.ts +10 -1
  28. package/src/cli/commands/crypto-hints.ts +3 -2
  29. package/src/cli/commands/fred-series.ts +0 -54
  30. package/src/cli/commands/market.ts +209 -31
  31. package/src/cli/commands/overview.ts +47 -14
  32. package/src/cli/commands/search.ts +37 -8
  33. package/src/cli/commands/ticker.ts +15 -4
  34. package/src/cli/desktop-pane-shot.ts +27 -2
  35. package/src/cli/fx-quote-rate.ts +1 -1
  36. package/src/cli/glossary.ts +14 -5
  37. package/src/cli/history-catalog-series.ts +85 -0
  38. package/src/cli/index.ts +1 -1
  39. package/src/cli/list-progress.ts +45 -0
  40. package/src/cli/listing-arg.ts +71 -7
  41. package/src/cli/name-entries.ts +8 -4
  42. package/src/cli/not-a-ticker.ts +2 -2
  43. package/src/cli/pane-functions/freshness.ts +50 -3
  44. package/src/cli/pane-functions/index.ts +7 -4
  45. package/src/cli/pane-functions/market-session.ts +66 -14
  46. package/src/cli/pane-functions/options.ts +5 -0
  47. package/src/cli/pane-functions/resolver.ts +9 -2
  48. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  49. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  50. package/src/cli/quote-answer.ts +49 -10
  51. package/src/cli/quote-list-reads.ts +87 -0
  52. package/src/cli/report-tables.ts +70 -13
  53. package/src/cli/result.ts +24 -2
  54. package/src/cli/symbol-list.ts +31 -4
  55. package/src/cli/terminal-code-hints.ts +83 -0
  56. package/src/cli/ticker-resolution.ts +2 -1
  57. package/src/cli/treasury-yields.ts +5 -0
  58. package/src/components/chart/native/kitty/manager.ts +2 -0
  59. package/src/components/chart/native/surface/manager.ts +211 -11
  60. package/src/components/command-bar/action-runtime.ts +2 -0
  61. package/src/components/command-bar/panel/index.tsx +2 -13
  62. package/src/components/command-bar/panel/layout.ts +1 -7
  63. package/src/components/command-bar/panel/runtime.ts +0 -1
  64. package/src/components/command-bar/panel/types.ts +0 -2
  65. package/src/components/command-bar/routing/launch-request.ts +2 -1
  66. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  67. package/src/components/command-bar/workflow/types.ts +6 -0
  68. package/src/components/data-table/column-menu.tsx +89 -0
  69. package/src/components/data-table/sort-menu.tsx +9 -2
  70. package/src/components/data-table/view.tsx +33 -6
  71. package/src/components/form-modal/content.tsx +10 -0
  72. package/src/components/index.ts +1 -1
  73. package/src/components/layout/detached-pane-shell.tsx +3 -0
  74. package/src/components/layout/double-escape-close.ts +34 -3
  75. package/src/components/layout/floating-pane.tsx +10 -4
  76. package/src/components/layout/pane/cycle-order.ts +66 -2
  77. package/src/components/layout/pane/footer/index.tsx +25 -11
  78. package/src/components/layout/pane/footer/model.ts +62 -20
  79. package/src/components/layout/pane/header.tsx +140 -31
  80. package/src/components/layout/pane/sidebar.tsx +138 -20
  81. package/src/components/layout/pane/status-footer.ts +3 -1
  82. package/src/components/layout/shell/active-drag.ts +18 -13
  83. package/src/components/layout/shell/drag/magnets.ts +34 -18
  84. package/src/components/layout/shell/drag/runtime.ts +5 -0
  85. package/src/components/layout/shell/index.tsx +25 -0
  86. package/src/components/layout/shell/menu.ts +9 -0
  87. package/src/components/layout/shell/pane/actions.ts +36 -0
  88. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  89. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  90. package/src/components/layout/shell/shortcuts.ts +17 -1
  91. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  92. package/src/components/layout/shell/window-mode/index.ts +5 -16
  93. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  94. package/src/components/market-board/index.tsx +14 -5
  95. package/src/components/metric-treemap/index.tsx +3 -1
  96. package/src/components/ticker/list-table-view.tsx +5 -0
  97. package/src/components/ui/button.tsx +48 -4
  98. package/src/components/ui/data-table/column-order.ts +180 -0
  99. package/src/components/ui/data-table/index.tsx +12 -1
  100. package/src/components/ui/data-table/opentui/index.tsx +291 -32
  101. package/src/components/ui/data-table/opentui/model.ts +43 -4
  102. package/src/components/ui/data-table/types.ts +56 -0
  103. package/src/components/ui/data-table/use-column-order.ts +135 -0
  104. package/src/components/ui/index.ts +1 -1
  105. package/src/components/ui/inline-quick-add.tsx +19 -3
  106. package/src/components/ui/list-view.tsx +11 -5
  107. package/src/components/ui/query-bar.tsx +16 -1
  108. package/src/components/ui/selection-fill.ts +39 -0
  109. package/src/components/ui/table-layout.ts +120 -0
  110. package/src/core/state/app/layout-reducer.ts +2 -1
  111. package/src/core/state/app/pane-choices.ts +68 -0
  112. package/src/core/state/app/state.ts +14 -6
  113. package/src/core/state/app/types.ts +8 -0
  114. package/src/docs/snapshot.json +3 -2
  115. package/src/i18n/es.ts +2 -0
  116. package/src/i18n/ja.ts +2 -0
  117. package/src/i18n/ko.ts +2 -0
  118. package/src/i18n/zh-cn.ts +2 -0
  119. package/src/i18n/zh-tw.ts +2 -0
  120. package/src/layout/pane-manager/dock-tree.ts +19 -0
  121. package/src/layout/pane-manager/index.ts +3 -0
  122. package/src/market-data/coordinator/index.ts +4 -3
  123. package/src/market-data/coordinator/quotes.ts +12 -4
  124. package/src/market-data/market/freshness.ts +33 -0
  125. package/src/market-data/market/status.ts +5 -1
  126. package/src/market-data/quotes/contributions.ts +10 -0
  127. package/src/market-data/quotes/freshness.ts +31 -0
  128. package/src/market-data/quotes/live-valuation.ts +32 -5
  129. package/src/market-data/quotes/regular-session-valuation.ts +1 -1
  130. package/src/market-data/quotes/resolution.ts +4 -0
  131. package/src/market-data/quotes/time.ts +0 -14
  132. package/src/plugins/builtin/account-management/index.tsx +1 -0
  133. package/src/plugins/builtin/awards/detail.tsx +12 -4
  134. package/src/plugins/builtin/awards/headless.ts +29 -8
  135. package/src/plugins/builtin/awards/model.ts +36 -2
  136. package/src/plugins/builtin/awards/pane.tsx +7 -4
  137. package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
  138. package/src/plugins/builtin/broker-manager/index.tsx +7 -6
  139. package/src/plugins/builtin/broker-manager/model.ts +15 -6
  140. package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
  141. package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
  142. package/src/plugins/builtin/broker-manager/table.ts +10 -4
  143. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  144. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  145. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  146. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  147. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  148. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  149. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  150. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  151. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  152. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  153. package/src/plugins/builtin/chat/sidebar.tsx +35 -19
  154. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  155. package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
  156. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  157. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  158. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  159. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  160. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  161. package/src/plugins/builtin/connections/index.ts +1 -0
  162. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  163. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  164. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  165. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  166. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  167. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  168. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  169. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  170. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  171. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  173. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  174. package/src/plugins/builtin/earnings/board.tsx +15 -3
  175. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  176. package/src/plugins/builtin/earnings/client.ts +0 -9
  177. package/src/plugins/builtin/earnings/headless.ts +10 -7
  178. package/src/plugins/builtin/earnings/history.tsx +21 -14
  179. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  180. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  181. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  182. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  183. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  184. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  185. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  186. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  187. package/src/plugins/builtin/econ/index.tsx +9 -2
  188. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  189. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  190. package/src/plugins/builtin/equity-screener/live.ts +74 -18
  191. package/src/plugins/builtin/equity-screener/model.ts +19 -4
  192. package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
  193. package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
  194. package/src/plugins/builtin/equity-screener/results.ts +22 -2
  195. package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
  196. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  197. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  198. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  199. package/src/plugins/builtin/futures/index.tsx +15 -1
  200. package/src/plugins/builtin/futures/table.tsx +1 -1
  201. package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
  202. package/src/plugins/builtin/holders/pane.tsx +30 -20
  203. package/src/plugins/builtin/insider/table.tsx +10 -7
  204. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  205. package/src/plugins/builtin/iv-history/events.ts +5 -0
  206. package/src/plugins/builtin/iv-history/headless.ts +15 -9
  207. package/src/plugins/builtin/jobs/index.tsx +1 -0
  208. package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
  209. package/src/plugins/builtin/macro-day/headless.ts +15 -6
  210. package/src/plugins/builtin/macro-day/model.ts +1 -1
  211. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  212. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  213. package/src/plugins/builtin/market-movers/model.ts +5 -0
  214. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  215. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  216. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  217. package/src/plugins/builtin/options/view.tsx +3 -0
  218. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  219. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  220. package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
  221. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  222. package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
  223. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  224. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  225. package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
  226. package/src/plugins/builtin/rate-path/pane.tsx +2 -0
  227. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  228. package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
  229. package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
  230. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  231. package/src/plugins/builtin/seasonality/pane.tsx +2 -1
  232. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  233. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  234. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  235. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  236. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  237. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  238. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  239. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  240. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  241. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  242. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  243. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  244. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  245. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  246. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  247. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  248. package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
  249. package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
  250. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
  251. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
  252. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  253. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  254. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  255. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  256. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  257. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  258. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  259. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  260. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  261. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  262. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  263. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  264. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  265. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  266. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  267. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  268. package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
  269. package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
  270. package/src/plugins/builtin/world-indices/index.tsx +5 -1
  271. package/src/plugins/builtin/yield-curve/index.tsx +2 -1
  272. package/src/plugins/runtime/index.tsx +1 -0
  273. package/src/plugins/runtime/state.ts +20 -0
  274. package/src/portfolio/column-values.ts +8 -2
  275. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  276. package/src/public/react.ts +7 -0
  277. package/src/react/auto-refresh.ts +29 -0
  278. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  279. package/src/renderers/dom/data-table/column-drag.ts +147 -0
  280. package/src/renderers/dom/data-table/index.tsx +22 -0
  281. package/src/renderers/dom/data-table/row.tsx +27 -5
  282. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  283. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  284. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  285. package/src/renderers/dom/styles.css +47 -5
  286. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  287. package/src/renderers/opentui/chart-surface.tsx +1 -0
  288. package/src/renderers/opentui/frame-hits.ts +33 -0
  289. package/src/renderers/opentui/host.tsx +2 -0
  290. package/src/renderers/opentui/native-surface.ts +14 -21
  291. package/src/renderers/opentui/test-utils.tsx +3 -0
  292. package/src/series/types.ts +2 -0
  293. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  294. package/src/sources/gloomberb-cloud/index.ts +25 -1
  295. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  296. package/src/sources/provider-errors.ts +64 -1
  297. package/src/sources/provider-router/batches.ts +19 -0
  298. package/src/sources/provider-router/index.ts +7 -1
  299. package/src/state/app/context/index.tsx +46 -1
  300. package/src/state/pane-unsent-work.ts +47 -0
  301. package/src/test-support/app-store.ts +24 -1
  302. package/src/test-support/shell-pane-keys.tsx +5 -0
  303. package/src/test-support/telemetry-guard.ts +83 -0
  304. package/src/test-support/test-env.ts +12 -0
  305. package/src/theme/colors.ts +17 -1
  306. package/src/theme/ui-tokens.ts +50 -1
  307. package/src/tickers/listing-venues.ts +11 -1
  308. package/src/tickers/search/japanese-names.json +1 -0
  309. package/src/tickers/search/japanese-names.ts +152 -0
  310. package/src/tickers/terminal-codes.ts +55 -6
  311. package/src/time-series/base-series.ts +3 -0
  312. package/src/time-series/live-quotes.ts +3 -9
  313. package/src/types/data-provider.ts +6 -0
  314. package/src/types/financials.ts +11 -0
  315. package/src/types/plugin-contributions.ts +7 -0
  316. package/src/types/plugin-panes.ts +7 -0
  317. package/src/ui/host.tsx +24 -0
  318. package/src/ui/pointer-drag.ts +11 -2
  319. package/src/utils/double-escape-close.ts +42 -0
  320. package/src/utils/fundamentals.ts +14 -3
  321. package/src/utils/fx-status.ts +30 -7
  322. package/src/utils/network-failure.ts +23 -0
  323. package/src/utils/share-multiples.cases.json +780 -2
  324. package/src/utils/share-multiples.ts +154 -24
@@ -467,6 +467,16 @@ export function FormModalContent({
467
467
  }
468
468
  }, [desktop, showsFields]);
469
469
 
470
+ // A body its fields fit shows no scrollbar. Left to the scroll box, a bar shown while the body was shorter
471
+ // would stay: it takes the text a column, and a line as wide as the body wraps to a row more than it holds.
472
+ const bodyFits = fieldRowsHeight <= availableRows;
473
+ useLayoutEffect(() => {
474
+ const bar = desktop || !showsFields ? null : scrollRef.current?.verticalScrollBar;
475
+ if (!bar) return;
476
+ if (bodyFits) bar.visible = false;
477
+ else bar.resetVisibilityControl?.();
478
+ }, [bodyFits, desktop, showsFields]);
479
+
470
480
  // After layout, so a field that dependsOn just revealed is measured, and
471
481
  // again when the body's height changes (an error line takes a row from it).
472
482
  useEffect(() => {
@@ -147,7 +147,7 @@ export {
147
147
  export type {
148
148
  ActionRowProps, BadgeProps, BulletListProps, ButtonProps, ButtonVariant, CardProps, CheckboxProps, ChoiceDialogChoice, ColumnGridCell,
149
149
  ColumnGridColumn, ColumnGridLink, ColumnGridPairProps, ColumnGridProps, ConfirmDialogOptions, CountryFlagProps,
150
- DataTableCell, DataTableColumn, DataTableProps, DataTableVisibleRange, DetailScrollBodyProps, DialogFrameProps,
150
+ DataTableCell, DataTableColumn, DataTableColumnReorder, DataTableProps, DataTableVisibleRange, DetailScrollBodyProps, DialogFrameProps,
151
151
  DisclosureMarkerProps, DividerProps, EmptyStateProps, FieldGridProps, FieldLabelProps, FieldRing, FieldRingOptions,
152
152
  FigureListItem, FigureListProps, GridField,
153
153
  IconButtonPressEvent, IconButtonProps, IconName, IconProps, InlineQuickAddRowProps,
@@ -41,6 +41,7 @@ import { paneMenuButtonAnchor, ShellActionMenuOverlay, type ActionMenuState } fr
41
41
  import { getPaneFooter } from "./pane/footer";
42
42
  import { requestPaneDocs } from "../../docs/requests";
43
43
  import { DOCS_PANE_TEMPLATE_ID } from "../../docs/content";
44
+ import { paneHoldsUnsentWork } from "../../state/pane-unsent-work";
44
45
 
45
46
  interface DetachedPaneShellProps {
46
47
  pluginRegistry: PluginRegistry;
@@ -130,6 +131,8 @@ export function DetachedPaneShell({ pluginRegistry, desktopWindowBridge }: Detac
130
131
  overlayOpen: dialogOpen || menuState !== null,
131
132
  editing: inputCaptured,
132
133
  close: () => {
134
+ // A draft not sent or an answer coming in keeps the window: the Esc goes on to the pane.
135
+ if (paneHoldsUnsentWork(desktopWindowBridge.paneId)) return false;
133
136
  if (!locked) fireAndForget(desktopWindowBridge.closeDetachedPane?.(desktopWindowBridge.paneId), "desktop.closeDetachedPane");
134
137
  return true;
135
138
  },
@@ -4,9 +4,12 @@ import {
4
4
  armDoubleEscapeClose,
5
5
  createDoubleEscapeCloseState,
6
6
  isEscapeKeptFromClosing,
7
+ isHeldEscapePress,
7
8
  offerEscapeTowardClose,
8
9
  resetDoubleEscapeClose,
10
+ swallowEscapeAfterSingleClose,
9
11
  takeDoubleEscapeClose,
12
+ takeSingleEscapeClose,
10
13
  } from "../../utils/double-escape-close";
11
14
 
12
15
  function isEscapeKey(event: KeyEventLike): boolean {
@@ -24,11 +27,19 @@ interface DoubleEscapeCloseOptions {
24
27
  dragging?: () => boolean;
25
28
  /** Closes the target; false when nothing was closed and the Esc goes on to the pane. */
26
29
  close(): boolean;
30
+ /**
31
+ * Closes the target on one Esc that nothing in it took, where one Esc is
32
+ * enough (a floating window); false where it is not, and the Esc goes on.
33
+ */
34
+ closeOnSingle?: () => boolean;
27
35
  }
28
36
 
29
37
  /**
30
38
  * Esc Esc closes the focused pane, even one that could still go back: every
31
- * Esc is the first half of a pair, whatever the pane did with it. Kept out:
39
+ * Esc is the first half of a pair, whatever the pane did with it. Where one
40
+ * Esc is enough (`closeOnSingle`, a floating window), an Esc nothing took
41
+ * closes it, and the Esc after it at a double press's pace closes nothing
42
+ * more. Kept out:
32
43
  *
33
44
  * - an Esc in a text field, or while the pane is editing, unless the pane
34
45
  * counts it because nothing typed is left behind (an empty composer);
@@ -43,10 +54,12 @@ interface DoubleEscapeCloseOptions {
43
54
  * A surface that takes Esc in a scoped `before` handler (onboarding, a form,
44
55
  * key capture) runs ahead of the arming and so never counts.
45
56
  */
46
- export function useDoubleEscapeClose({ targetId, overlayOpen, editing, dragging, close }: DoubleEscapeCloseOptions): void {
57
+ export function useDoubleEscapeClose({ targetId, overlayOpen, editing, dragging, close, closeOnSingle }: DoubleEscapeCloseOptions): void {
47
58
  const stateRef = useRef(createDoubleEscapeCloseState());
48
59
  const live = useRef({ targetId, overlayOpen });
49
60
  live.current = { targetId, overlayOpen };
61
+ /** Esc presses that came as a held key's, judged before they armed anything. */
62
+ const heldRef = useRef(new WeakSet<object>());
50
63
 
51
64
  useEffect(() => {
52
65
  if (overlayOpen) resetDoubleEscapeClose(stateRef.current);
@@ -60,6 +73,7 @@ export function useDoubleEscapeClose({ targetId, overlayOpen, editing, dragging,
60
73
  return;
61
74
  }
62
75
  const at = Date.now();
76
+ if (isHeldEscapePress(state, at, event.repeat)) heldRef.current.add(event);
63
77
  offerEscapeTowardClose(event, {
64
78
  count: () => {
65
79
  if (!live.current.overlayOpen) armDoubleEscapeClose(state, live.current.targetId, at, event.repeat);
@@ -72,12 +86,29 @@ export function useDoubleEscapeClose({ targetId, overlayOpen, editing, dragging,
72
86
  // with more to go back through still closes. Not in a text field.
73
87
  useShortcut((event) => {
74
88
  if (!isEscapeKey(event) || overlayOpen || editing || dragging?.()) return;
75
- if (takeDoubleEscapeClose(stateRef.current, targetId, Date.now(), event.repeat) && close()) {
89
+ const now = Date.now();
90
+ if (swallowEscapeAfterSingleClose(stateRef.current, now, event.repeat)) {
91
+ event.preventDefault();
92
+ event.stopPropagation();
93
+ return;
94
+ }
95
+ if (takeDoubleEscapeClose(stateRef.current, targetId, now, event.repeat) && close()) {
76
96
  event.preventDefault();
77
97
  event.stopPropagation();
78
98
  }
79
99
  }, { phase: "capture" });
80
100
 
101
+ // One Esc that nothing took (the window had nothing to back out of, no menu
102
+ // to close) closes a floating window, as it does a dialog or Help.
103
+ useShortcut((event) => {
104
+ if (!closeOnSingle || !isEscapeKey(event) || overlayOpen || editing || dragging?.()) return;
105
+ if (isEscapeKeptFromClosing(event) || heldRef.current.has(event)) return;
106
+ if (!closeOnSingle()) return;
107
+ takeSingleEscapeClose(stateRef.current, Date.now());
108
+ event.preventDefault();
109
+ event.stopPropagation();
110
+ }, { phase: "idle" });
111
+
81
112
  // The first: after the scoped surfaces that own their Esc (onboarding, a
82
113
  // form, key capture), so theirs never counts, and before the pane.
83
114
  useShortcut((event) => {
@@ -54,19 +54,25 @@ interface FloatingPaneWrapperProps {
54
54
  children: ReactNode;
55
55
  }
56
56
 
57
- function TerminalFloatingPaneBorder({ width, height }: { width: number; height: number }) {
57
+ /**
58
+ * The window's sides, between its title bar and footer, which draw the top
59
+ * and bottom of the frame. Focused or not, so what is under the window never
60
+ * runs into it; focus draws them in the focus colour, as it does the rest.
61
+ */
62
+ function TerminalFloatingPaneBorder({ width, height, focused }: { width: number; height: number; focused: boolean }) {
58
63
  const borderWidth = Math.max(0, Math.floor(width));
59
64
  const borderHeight = Math.max(0, Math.floor(height));
60
65
  const bodyHeight = Math.max(0, borderHeight - 2);
61
66
  if (borderWidth < 2 || bodyHeight <= 0) return null;
67
+ const color = focused ? colors.borderFocused : colors.border;
62
68
 
63
69
  return (
64
70
  <>
65
71
  <Box position="absolute" top={1} left={0} width={1} height={bodyHeight}>
66
- <Text fg={colors.border} selectable={false}>{"│".repeat(bodyHeight)}</Text>
72
+ <Text fg={color} selectable={false}>{"│".repeat(bodyHeight)}</Text>
67
73
  </Box>
68
74
  <Box position="absolute" top={1} left={borderWidth - 1} width={1} height={bodyHeight}>
69
- <Text fg={colors.border} selectable={false}>{"│".repeat(bodyHeight)}</Text>
75
+ <Text fg={color} selectable={false}>{"│".repeat(bodyHeight)}</Text>
70
76
  </Box>
71
77
  </>
72
78
  );
@@ -186,7 +192,7 @@ export function FloatingPaneWrapper({
186
192
  />
187
193
  )}
188
194
 
189
- {!nativePaneChrome && !focused && <TerminalFloatingPaneBorder width={width} height={height} />}
195
+ {!nativePaneChrome && <TerminalFloatingPaneBorder width={width} height={height} focused={focused || windowModeSelected} />}
190
196
 
191
197
  {nativePaneChrome ? (
192
198
  <Box
@@ -1,23 +1,87 @@
1
- import { getDockedPaneIds } from "../../../layout/pane-manager";
1
+ import {
2
+ dockStackTabIds,
3
+ floatingStackMembers,
4
+ getDockedPaneIds,
5
+ hiddenDockTabIds,
6
+ hiddenFloatingTabIds,
7
+ } from "../../../layout/pane-manager";
2
8
  import type { PluginRegistry } from "../../../plugins/registry";
3
9
  import { findPaneInstance, type LayoutConfig } from "../../../types/config";
4
10
  import { collectDisabledPaneIds } from "../shell/visible-layout";
5
11
 
12
+ interface PaneCycleOptions {
13
+ /**
14
+ * Docked panes whose title bar floating windows hide: focus there could not
15
+ * be seen, so Tab passes them by (`coveredDockedPaneIds`).
16
+ */
17
+ covered?: ReadonlySet<string>;
18
+ /** Keeps its place in the order whatever covers it, so Tab moves on from where focus is. */
19
+ focusedPaneId?: string | null;
20
+ }
21
+
22
+ /**
23
+ * The panes Tab and Shift+Tab step through, docked then floating: every pane
24
+ * that shows, a stack once (the tab it shows, never one it hides), and no
25
+ * docked pane a floating window hides. When nothing but the covered panes is
26
+ * left, those.
27
+ */
6
28
  export function getVisiblePaneCycleOrder(
7
29
  layout: LayoutConfig,
8
30
  pluginRegistry: PluginRegistry,
9
31
  disabledPlugins: readonly string[],
32
+ { covered, focusedPaneId = null }: PaneCycleOptions = {},
10
33
  ): string[] {
11
34
  const disabledTypes = collectDisabledPaneIds(pluginRegistry, disabledPlugins);
35
+ const hiddenTabs = new Set([...hiddenDockTabIds(layout), ...hiddenFloatingTabIds(layout.floating)]);
12
36
  const isVisiblePane = (instanceId: string) => {
13
37
  const instance = findPaneInstance(layout, instanceId);
14
38
  return !!instance
39
+ && (!hiddenTabs.has(instanceId) || instanceId === focusedPaneId)
15
40
  && !disabledTypes.has(instance.paneId)
16
41
  && pluginRegistry.panes.has(instance.paneId);
17
42
  };
18
43
 
19
- return [
44
+ const visible = [
20
45
  ...getDockedPaneIds(layout),
21
46
  ...layout.floating.map((entry) => entry.instanceId),
22
47
  ].filter(isVisiblePane);
48
+ if (!covered || covered.size === 0) return visible;
49
+ const shown = visible.filter((instanceId) => instanceId === focusedPaneId || !covered.has(instanceId));
50
+ return shown.some((instanceId) => instanceId !== focusedPaneId) ? shown : visible;
51
+ }
52
+
53
+ /**
54
+ * The tab of `paneId`'s stack, docked or floating, `direction` steps from it
55
+ * in tab order, round from the last to the first: what the next- and
56
+ * previous-tab keys show, since Tab passes the tabs a stack hides. Null when
57
+ * the pane is in no stack.
58
+ */
59
+ export function adjacentStackTabId(layout: LayoutConfig, paneId: string | null, direction: 1 | -1): string | null {
60
+ if (!paneId) return null;
61
+ const docked = dockStackTabIds(layout, paneId);
62
+ const tabs = docked.length > 1 ? docked : floatingStackMembers(layout.floating, paneId).map((entry) => entry.instanceId);
63
+ const index = tabs.indexOf(paneId);
64
+ if (tabs.length < 2 || index < 0) return null;
65
+ return tabs[(index + direction + tabs.length) % tabs.length]!;
66
+ }
67
+
68
+ const coveredSources = new Set<() => ReadonlySet<string>>();
69
+
70
+ /**
71
+ * The shell says which docked panes its floating windows hide, as it lays
72
+ * them out; Tab reads it when it moves focus. Returns the unregister.
73
+ */
74
+ export function registerCoveredPaneSource(source: () => ReadonlySet<string>): () => void {
75
+ coveredSources.add(source);
76
+ return () => {
77
+ coveredSources.delete(source);
78
+ };
79
+ }
80
+
81
+ /** The docked panes the window's floating windows hide now (`registerCoveredPaneSource`). */
82
+ export function coveredDockedPaneIds(): ReadonlySet<string> {
83
+ if (coveredSources.size === 0) return new Set();
84
+ const covered = new Set<string>();
85
+ for (const source of coveredSources) for (const id of source()) covered.add(id);
86
+ return covered;
23
87
  }
@@ -18,6 +18,7 @@ import {
18
18
  separatesPaneFooterSegments,
19
19
  hasPaneFooterContent,
20
20
  layoutPaneFooterHintRow,
21
+ paneFooterInfoWidth,
21
22
  paneHintTitle,
22
23
  terminalHintMetrics,
23
24
  totalHintsWidth,
@@ -51,6 +52,9 @@ export {
51
52
  usePaneMenuItems,
52
53
  } from "./registration";
53
54
 
55
+ /** Terminal: blank cells between a framed footer's last hint and the frame's end. */
56
+ const FOOTER_FRAME_GAP = 1;
57
+
54
58
  function footerToneColor(part: PaneFooterPart): string {
55
59
  if (part.color) return part.color;
56
60
  switch (part.tone) {
@@ -86,10 +90,11 @@ function terminalSegmentKey(segment: PaneFooterSegment, focused: boolean): strin
86
90
  : "";
87
91
  }
88
92
 
89
- /** Columns an icon segment keeps when hints crowd the footer. */
93
+ /** Columns an icon segment keeps when hints crowd the footer: in the terminal, what it draws (`◷15m`, `⚠[!]`). */
90
94
  function iconSegmentReserve(segment: PaneFooterSegment, focused: boolean, nativePaneChrome: boolean): number {
91
95
  if (!segment.icon) return 0;
92
- return nativePaneChrome ? 3 : Math.max(3, 1 + terminalSegmentKey(segment, focused).length);
96
+ if (nativePaneChrome) return 3;
97
+ return Math.max(3, paneFooterInfoWidth([segment]) + terminalSegmentKey(segment, focused).length);
93
98
  }
94
99
 
95
100
  function SegmentView({ segment, focused }: { segment: PaneFooterSegment; focused: boolean }) {
@@ -265,12 +270,15 @@ function FooterContent({
265
270
  width,
266
271
  showBackground = true,
267
272
  nativePaneChrome = false,
273
+ trailingGap = 0,
268
274
  }: {
269
275
  footer: CombinedPaneFooter;
270
276
  focused: boolean;
271
277
  width?: number;
272
278
  showBackground?: boolean;
273
279
  nativePaneChrome?: boolean;
280
+ /** Blank cells of the band after the hints, past `width`, so they never touch the frame. */
281
+ trailingGap?: number;
274
282
  }) {
275
283
  const hasInfo = footer.info.length > 0;
276
284
  const actionableHints = focused ? footer.hints.filter((hint) => !hint.disabled) : [];
@@ -283,8 +291,10 @@ function FooterContent({
283
291
  const keyLabel = useShortcutLabel();
284
292
  const { cellWidthPx = 8 } = useUiCapabilities();
285
293
  const metrics = nativePaneChrome ? desktopHintMetrics(cellWidthPx) : terminalHintMetrics(keyLabel);
294
+ // A segment with shorter forms takes the longest that fits beside the hints, gaps and terminal keys included.
295
+ const keysWidth = nativePaneChrome ? 0 : footer.info.reduce((total, segment) => total + terminalSegmentKey(segment, focused).length, 0);
286
296
  const row = availableWidth !== null
287
- ? layoutPaneFooterHintRow({ ...footer, hints: actionableHints }, availableWidth, iconReserve, metrics)
297
+ ? layoutPaneFooterHintRow({ ...footer, hints: actionableHints }, availableWidth, iconReserve, metrics, { terminal: !nativePaneChrome, keysWidth })
288
298
  : null;
289
299
  const shownHints = row?.hints ?? actionableHints;
290
300
  const overflowHints = row?.overflow ?? [];
@@ -293,9 +303,7 @@ function FooterContent({
293
303
  const infoWidth = availableWidth !== null && hasInfo
294
304
  ? (row?.infoWidth ?? Math.max(0, availableWidth - hintsWidth))
295
305
  : undefined;
296
- // A segment with shorter forms takes the longest that fits beside the hints, gaps and terminal keys included.
297
- const keysWidth = nativePaneChrome ? 0 : footer.info.reduce((total, segment) => total + terminalSegmentKey(segment, focused).length, 0);
298
- const info = infoWidth != null ? fitPaneFooterInfo(footer.info, infoWidth - keysWidth, { besideHints: hasHints }) : footer.info;
306
+ const info = infoWidth != null ? fitPaneFooterInfo(footer.info, infoWidth - keysWidth, { besideHints: hasHints, terminal: !nativePaneChrome }) : footer.info;
299
307
  const lastTextIndex = info.findLastIndex((segment) => !segment.icon);
300
308
 
301
309
  if (!hasInfo && !hasHints) {
@@ -312,6 +320,7 @@ function FooterContent({
312
320
  flexDirection="row"
313
321
  justifyContent="space-between"
314
322
  overflow="hidden"
323
+ paddingRight={trailingGap > 0 ? trailingGap : undefined}
315
324
  backgroundColor={backgroundColor}
316
325
  >
317
326
  {hasInfo && (
@@ -428,16 +437,21 @@ export function PaneFooterBar({
428
437
  }
429
438
 
430
439
  if (focused || showBorder) {
431
- const contentWidth = Math.max(0, Math.floor(width) - 1 - reservedRight - (reservedRight > 0 ? 0 : 1));
440
+ // The row ends as the title bar does (` x ─┐`): the last hint, a blank, then the rule's last dash
441
+ // and the corner, or the floating pane's `─◢` in the cells it reserves. A hint against the dash
442
+ // read as one word (`ticker─`).
443
+ const ruleEnd = reservedRight > 0 ? "" : "─┘";
444
+ const rowWidth = Math.max(0, Math.floor(width) - 1 - reservedRight - ruleEnd.length);
445
+ const contentWidth = Math.max(0, rowWidth - FOOTER_FRAME_GAP);
432
446
  return (
433
447
  <Box height={1} width={width} flexDirection="row" data-gloom-role="pane-footer" data-focused={focused ? "true" : "false"} data-empty={empty ? "true" : "false"}>
434
448
  <Text fg={borderColor} selectable={false}>└</Text>
435
- <Box width={contentWidth} height={1} overflow="hidden">
449
+ <Box width={rowWidth} height={1} overflow="hidden">
436
450
  {empty
437
- ? <Text fg={borderColor} selectable={false}>{"─".repeat(contentWidth)}</Text>
438
- : <FooterContent footer={resolvedFooter} focused={focused} width={contentWidth} />}
451
+ ? <Text fg={borderColor} selectable={false}>{"─".repeat(rowWidth)}</Text>
452
+ : <FooterContent footer={resolvedFooter} focused={focused} width={contentWidth} trailingGap={rowWidth - contentWidth} />}
439
453
  </Box>
440
- {reservedRight === 0 && <Text fg={borderColor} selectable={false}>┘</Text>}
454
+ {ruleEnd && <Text fg={borderColor} selectable={false}>{ruleEnd}</Text>}
441
455
  </Box>
442
456
  );
443
457
  }
@@ -344,6 +344,11 @@ export function totalHintsWidth(hints: readonly Pick<PaneHint, "key" | "label" |
344
344
  return Math.ceil(hints.reduce((total, hint, index) => total + (index > 0 ? metrics.gap : 0) + metrics.width(hint), 0) - 1e-9);
345
345
  }
346
346
 
347
+ /** Cells `segments` take side by side, separators and gaps included, the terminal's keys aside. */
348
+ export function paneFooterInfoWidth(segments: readonly PaneFooterSegment[]): number {
349
+ return infoTextWidth(segments);
350
+ }
351
+
347
352
  function infoTextWidth(segments: readonly PaneFooterSegment[]): number {
348
353
  if (segments.length === 0) return 0;
349
354
  return segments.reduce((total, segment, index) => {
@@ -371,22 +376,33 @@ function stepDownTogether(info: PaneFooterSegment[], width: number): PaneFooterS
371
376
  return fitted;
372
377
  }
373
378
 
379
+ /** A warning, an icon or a pressable segment, which a row too narrow never cuts or leaves out. */
380
+ function holdsItsPlace(segment: PaneFooterSegment): boolean {
381
+ return !!segment.icon || !!segment.onPress || segment.parts.some((part) => part.tone === "warning" || part.tone === "negative");
382
+ }
383
+
374
384
  /**
375
385
  * A trailing status cut mid-word reads as part of the hints beside it ("quote
376
- * 12h t[x] put"): one that does not fit ends in an ellipsis a column short of
377
- * them, or is left out when less than half of it would show, until the row
378
- * fits or `keep` segments are left. A warning, an icon or a pressable segment
379
- * stays as it is, clipped by the row if it must be.
386
+ * 12h t[x] put"): the last segment that does not fit ends in an ellipsis (a
387
+ * column short of the hints when it ends the row), or is left out when less
388
+ * than half of it would show, until the row fits or only the first `keep`
389
+ * segments are left to give way. A warning, an icon or a pressable segment
390
+ * holds its place, clipped by the row if it must be; in the terminal
391
+ * (`pastHeld`) the text before it gives way instead (a delay clock after the
392
+ * count it qualifies), where the desktop stops there.
380
393
  */
381
- function trimTrailing(info: PaneFooterSegment[], width: number, keep: number): PaneFooterSegment[] {
394
+ function trimTrailing(info: PaneFooterSegment[], width: number, keep: number, pastHeld: boolean): PaneFooterSegment[] {
382
395
  let fitted = info;
383
- while (fitted.length > keep && infoTextWidth(fitted) > width) {
384
- const last = fitted.at(-1)!;
385
- if (last.icon || last.onPress || last.parts.some((part) => part.tone === "warning" || part.tone === "negative")) break;
386
- // After the separator, a column short of the hints.
387
- const room = width - infoTextWidth(fitted.slice(0, -1)) - segmentGapWidth(fitted.at(-2)!, last) - 1;
388
- if (room * 2 >= infoTextWidth([last])) return [...fitted.slice(0, -1), clipSegment(last, room)];
389
- fitted = fitted.slice(0, -1);
396
+ while (infoTextWidth(fitted) > width) {
397
+ const index = pastHeld
398
+ ? fitted.findLastIndex((segment) => !holdsItsPlace(segment))
399
+ : holdsItsPlace(fitted.at(-1)!) ? -1 : fitted.length - 1;
400
+ if (index < keep) break;
401
+ const segment = fitted[index]!;
402
+ const own = infoTextWidth([segment]);
403
+ const room = width - (infoTextWidth(fitted) - own) - (index === fitted.length - 1 ? 1 : 0);
404
+ if (room * 2 >= own) return [...fitted.slice(0, index), clipSegment(segment, room), ...fitted.slice(index + 1)];
405
+ fitted = [...fitted.slice(0, index), ...fitted.slice(index + 1)];
390
406
  }
391
407
  return fitted;
392
408
  }
@@ -403,18 +419,22 @@ function trimTrailing(info: PaneFooterSegment[], width: number, keep: number): P
403
419
  * With no hints beside it (a pane picture's footer), the row clips the rest,
404
420
  * so a frame that fits its own status line sees it overflow.
405
421
  */
406
- export function fitPaneFooterInfo(info: PaneFooterSegment[], width: number, { besideHints = true }: { besideHints?: boolean } = {}): PaneFooterSegment[] {
422
+ export function fitPaneFooterInfo(
423
+ info: PaneFooterSegment[],
424
+ width: number,
425
+ { besideHints = true, terminal = false }: { besideHints?: boolean; terminal?: boolean } = {},
426
+ ): PaneFooterSegment[] {
407
427
  // How long ago the data loaded goes first, whole: a cut age (`fetched just`) says nothing.
408
428
  if (infoTextWidth(info) > width && info.some((segment) => segment.age)) {
409
- return fitPaneFooterInfo(info.filter((segment) => !segment.age), width, { besideHints });
429
+ return fitPaneFooterInfo(info.filter((segment) => !segment.age), width, { besideHints, terminal });
410
430
  }
411
431
  if (!besideHints) return stepDownTogether(info, width);
412
432
  const lastWithVariants = info.findLastIndex((segment) => (segment.variants?.length ?? 0) > 0);
413
433
  if (lastWithVariants >= 0 && lastWithVariants < info.length - 1 && infoTextWidth(info) > width) {
414
- const trimmed = trimTrailing(info, width, lastWithVariants + 1);
434
+ const trimmed = trimTrailing(info, width, lastWithVariants + 1, terminal);
415
435
  if (infoTextWidth(trimmed) <= width) return trimmed;
416
436
  }
417
- return trimTrailing(stepDownTogether(info, width), width, 1);
437
+ return trimTrailing(stepDownTogether(info, width), width, 1, terminal);
418
438
  }
419
439
 
420
440
  /** A segment cut to `width` behind an ellipsis, each part keeping its tone; the full text stays as its title. */
@@ -453,12 +473,28 @@ export interface PaneFooterHintRow {
453
473
  infoWidth: number;
454
474
  }
455
475
 
456
- /** Hints that fit this footer row, and the rest, which a More control owns. */
476
+ export interface PaneFooterHintRowOptions {
477
+ /** The terminal's row (layoutPaneFooterHintRow); the desktop's leaves it out. */
478
+ terminal?: boolean;
479
+ /** What the terminal draws besides the status's own text (`[!]` after an icon). */
480
+ keysWidth?: number;
481
+ }
482
+
483
+ /**
484
+ * Hints that fit this footer row, and the rest, which a More control owns.
485
+ * The status gives way to the hints down to its floor (INFO_FLOOR_CHARS,
486
+ * WARNING_FLOOR_CHARS, or `iconReserve`, the cells its icons take). In the
487
+ * terminal the status is kept whole while the first hint and More still fit
488
+ * beside it, hints going under More from the right first, and the status and
489
+ * the hints keep a column between them, so they never read as one
490
+ * ("777 matchesU◷1[m]etric").
491
+ */
457
492
  export function layoutPaneFooterHintRow(
458
493
  footer: CombinedPaneFooter,
459
494
  contentWidth: number,
460
495
  iconReserve = 0,
461
496
  metrics: PaneHintMetrics = TERMINAL_HINT_METRICS,
497
+ { terminal = false, keysWidth = 0 }: PaneFooterHintRowOptions = {},
462
498
  ): PaneFooterHintRow {
463
499
  const width = Math.max(0, Math.floor(contentWidth));
464
500
  const hints = footer.hints.filter((hint) => !hint.disabled);
@@ -469,8 +505,14 @@ export function layoutPaneFooterHintRow(
469
505
  const textFloor = footer.info.length === 0 ? 0
470
506
  : warning || infoChars <= WARNING_FLOOR_CHARS ? Math.min(WARNING_FLOOR_CHARS, infoChars)
471
507
  : INFO_FLOOR_CHARS;
472
- const infoFloor = Math.min(width, Math.max(iconReserve, textFloor));
473
- const hintBudget = Math.max(0, width - infoFloor - (infoFloor > 0 && hints.length > 0 ? 1 : 0));
508
+ const status = footer.info.length === 0 ? 0 : infoChars + keysWidth;
509
+ const leastHints = hints.length === 0 ? 0 : Math.min(
510
+ totalHintsWidth(hints, metrics),
511
+ Math.ceil(metrics.width(hints[0]!) + metrics.gap + moreControl(Number.POSITIVE_INFINITY).width),
512
+ );
513
+ const wholeStatus = terminal && status > 0 && status + (leastHints > 0 ? HINT_GAP + leastHints : 0) <= width;
514
+ const infoFloor = Math.min(width, wholeStatus ? status : Math.max(iconReserve, textFloor));
515
+ const hintBudget = Math.max(0, width - infoFloor - (infoFloor > 0 && hints.length > 0 ? HINT_GAP : 0));
474
516
  const more = moreControl(hintBudget);
475
517
  let visible = hints;
476
518
  let overflow: PaneHint[] = [];
@@ -495,7 +537,7 @@ export function layoutPaneFooterHintRow(
495
537
  moreLabel: more.label,
496
538
  moreWidth: more.width,
497
539
  hintsWidth,
498
- infoWidth: Math.max(0, width - hintsWidth),
540
+ infoWidth: Math.max(0, width - hintsWidth - (terminal && footer.info.length > 0 && hintsWidth > 0 ? HINT_GAP : 0)),
499
541
  };
500
542
  }
501
543