@oh-my-pi/pi-tui 18.14.2 → 18.16.0

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 (93) hide show
  1. package/CHANGELOG.md +64 -50
  2. package/README.md +1 -1
  3. package/dist/types/app-keybindings.d.ts +5 -0
  4. package/dist/types/apps/session-picker.d.ts +5 -3
  5. package/dist/types/chat/bash-execution.d.ts +4 -1
  6. package/dist/types/chat/eval-execution.d.ts +2 -0
  7. package/dist/types/chat/execution-shared.d.ts +14 -8
  8. package/dist/types/chat/transcript-render-helpers.d.ts +8 -0
  9. package/dist/types/chrome/dynamic-border.d.ts +6 -0
  10. package/dist/types/chrome/transcript-status.d.ts +2 -2
  11. package/dist/types/components/editor.d.ts +15 -6
  12. package/dist/types/components/loader.d.ts +2 -0
  13. package/dist/types/keybinding-matchers.d.ts +7 -0
  14. package/dist/types/overlays/btw-history-panel.d.ts +13 -0
  15. package/dist/types/overlays/btw-history.d.ts +24 -0
  16. package/dist/types/overlays/btw-inject.d.ts +22 -0
  17. package/dist/types/overlays/btw-panel.d.ts +7 -0
  18. package/dist/types/overlays/hook-editor.d.ts +2 -0
  19. package/dist/types/overlays/jobs-panel.d.ts +4 -0
  20. package/dist/types/overlays/session-selector.d.ts +24 -3
  21. package/dist/types/render/render-utils.d.ts +21 -1
  22. package/dist/types/status-line/startup.d.ts +0 -15
  23. package/dist/types/terminal-capabilities.d.ts +1 -1
  24. package/dist/types/theme/symbols.d.ts +3 -1
  25. package/dist/types/theme/theme-class.d.ts +1 -0
  26. package/dist/types/tools/grouped-file-output.d.ts +76 -8
  27. package/dist/types/tools/hashline-format.d.ts +5 -0
  28. package/dist/types/tools/native-view.d.ts +2 -0
  29. package/dist/types/tools/output-meta.d.ts +27 -0
  30. package/dist/types/tools/read.d.ts +10 -0
  31. package/dist/types/tools/wait.d.ts +2 -0
  32. package/dist/types/utils.d.ts +4 -0
  33. package/package.json +9 -9
  34. package/src/app-keybindings.ts +5 -0
  35. package/src/apps/session-picker.ts +7 -3
  36. package/src/chat/bash-execution.ts +20 -9
  37. package/src/chat/chat-transcript-builder.ts +5 -2
  38. package/src/chat/eval-execution.ts +14 -7
  39. package/src/chat/execution-shared.ts +39 -18
  40. package/src/chat/read-tool-group.ts +56 -36
  41. package/src/chat/transcript-render-helpers.ts +52 -6
  42. package/src/chrome/dynamic-border.ts +28 -2
  43. package/src/chrome/transcript-status.ts +5 -3
  44. package/src/components/editor.ts +123 -24
  45. package/src/components/key-value-list.ts +9 -9
  46. package/src/components/loader.ts +7 -0
  47. package/src/components/section.ts +1 -9
  48. package/src/components/table.ts +1 -9
  49. package/src/keybinding-matchers.ts +13 -0
  50. package/src/overlays/btw-history-panel.ts +98 -14
  51. package/src/overlays/btw-history.ts +65 -0
  52. package/src/overlays/btw-inject.ts +91 -0
  53. package/src/overlays/btw-panel.ts +53 -12
  54. package/src/overlays/hook-editor.ts +6 -0
  55. package/src/overlays/jobs-panel.ts +45 -19
  56. package/src/overlays/model-browser.ts +65 -8
  57. package/src/overlays/session-selector.ts +131 -26
  58. package/src/overlays/usage-dashboard.ts +2 -2
  59. package/src/render/code-cell.ts +1 -1
  60. package/src/render/file-list.ts +4 -7
  61. package/src/render/render-utils.ts +36 -6
  62. package/src/setup/scenes/glyph.ts +1 -1
  63. package/src/status-line/startup.ts +36 -70
  64. package/src/terminal-capabilities.ts +5 -0
  65. package/src/theme/symbols.ts +16 -9
  66. package/src/theme/theme-class.ts +3 -0
  67. package/src/tmux.ts +1 -0
  68. package/src/tools/agent-tree.ts +13 -11
  69. package/src/tools/ask.ts +13 -6
  70. package/src/tools/ast-edit.ts +48 -93
  71. package/src/tools/ast-grep.ts +22 -66
  72. package/src/tools/bash.ts +7 -0
  73. package/src/tools/default-renderer.ts +1 -1
  74. package/src/tools/edit.ts +50 -43
  75. package/src/tools/fetch.ts +2 -1
  76. package/src/tools/find.ts +6 -3
  77. package/src/tools/github.ts +14 -46
  78. package/src/tools/glob.ts +2 -1
  79. package/src/tools/grep.ts +43 -287
  80. package/src/tools/grouped-file-output.ts +250 -64
  81. package/src/tools/hashline-format.ts +5 -0
  82. package/src/tools/json-tree.ts +1 -5
  83. package/src/tools/lsp.ts +53 -25
  84. package/src/tools/native-view.ts +11 -5
  85. package/src/tools/output-meta.ts +68 -4
  86. package/src/tools/proc-render.ts +3 -3
  87. package/src/tools/read.ts +14 -0
  88. package/src/tools/task.ts +34 -77
  89. package/src/tools/vibe.ts +4 -4
  90. package/src/tools/wait.ts +8 -5
  91. package/src/tools/write.ts +17 -27
  92. package/src/tools/yield.ts +1 -1
  93. package/src/utils.ts +10 -0
package/src/tools/grep.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as path from "node:path";
2
- import { isRecord, sanitizeText } from "@oh-my-pi/pi-utils";
1
+ import { isRecord } from "@oh-my-pi/pi-utils";
3
2
  import type { Component } from "../tui";
4
3
  import { Text } from "../components/text";
5
4
  import type {
@@ -15,30 +14,26 @@ import { footnoteText, inlineErrorView, resultText } from "./native-view";
15
14
  import { type Theme } from "../theme/theme";
16
15
  import type { OutputMeta } from "./output-meta";
17
16
  import type { TruncationResult } from "./streaming-output";
18
- import { toPathList } from "../render/render-utils";
19
- import {
20
- fileHyperlink,
21
- getTreeBranch,
22
- getTreeContinuePrefix,
23
- renderStatusLine,
24
- renderTreeList,
25
- uriHyperlink,
26
- } from "../render";
17
+ import { fileHyperlink, renderStatusLine, renderTreeList } from "../render";
27
18
  import {
28
19
  createCachedComponent,
29
20
  fitHeaderedRows,
30
21
  formatCount,
31
22
  formatEmptyMessage,
32
23
  formatErrorMessage,
33
- formatMoreItems,
34
24
  PREVIEW_LIMITS,
35
- replaceTabs,
25
+ toPathList,
36
26
  } from "../render/render-utils";
37
27
  import {
38
28
  classifyGroupedLines,
39
29
  createCodeFrameStyler,
30
+ createGroupedRowStyler,
40
31
  describeGroupedOutput,
32
+ fitGroupsToBudget,
33
+ groupedLinkTargets,
41
34
  groupLineIndicesByBlank,
35
+ groupsByFile,
36
+ isMatchRow,
42
37
  } from "./grouped-file-output";
43
38
 
44
39
  /** Display metadata for grep tool results. */
@@ -97,259 +92,12 @@ const EXPANDED_TEXT_LIMIT = PREVIEW_LIMITS.EXPANDED_LINES * 2;
97
92
  /** Files a collapsed native grep shows (§7.3). */
98
93
  const NATIVE_COLLAPSED_FILES = 2;
99
94
 
100
- const SEARCH_CODE_FRAME_LINE_RE = /^\s*\*?(\d+)│/;
101
-
102
95
  function searchScopeMeta(details: GrepToolDetails | undefined, searchPath?: string): string | undefined {
103
96
  if (!details?.scopePath) return undefined;
104
97
  const label = searchPath ? fileHyperlink(searchPath, details.scopePath) : details.scopePath;
105
98
  return `in ${label}`;
106
99
  }
107
100
 
108
- function isStringArray(value: unknown): value is string[] {
109
- return Array.isArray(value) && value.every((item: unknown) => typeof item === "string");
110
- }
111
-
112
- function isStringRecord(value: unknown): value is Record<string, string> {
113
- if (!isRecord(value)) return false;
114
- for (const key in value) {
115
- if (typeof value[key] !== "string") return false;
116
- }
117
- return true;
118
- }
119
-
120
- function samePath(filePath: string): string {
121
- return filePath;
122
- }
123
-
124
- /** Keep only path metadata from the original details; display text always comes from sanitized details. */
125
- function grepLinkTargets(details: GrepToolDetails | undefined, rawDetails: unknown) {
126
- if (details === rawDetails) {
127
- return {
128
- target: samePath,
129
- searchPath: details?.searchPath,
130
- fileScope: details?.searchPath,
131
- displayTargets: details?.displayTargets,
132
- };
133
- }
134
- const raw = typeof rawDetails === "object" && rawDetails !== null ? rawDetails : {};
135
- const rawCwd = "cwd" in raw && typeof raw.cwd === "string" ? raw.cwd : undefined;
136
- const rawSearchPath = "searchPath" in raw && typeof raw.searchPath === "string" ? raw.searchPath : undefined;
137
- const rawFiles = "files" in raw && isStringArray(raw.files) ? raw.files : undefined;
138
- const rawDisplayTargets =
139
- "displayTargets" in raw && isStringRecord(raw.displayTargets) ? raw.displayTargets : undefined;
140
- let displayTargets = details?.displayTargets;
141
- if (rawDisplayTargets) {
142
- displayTargets = {};
143
- for (const label in rawDisplayTargets) {
144
- displayTargets[sanitizeText(label)] = rawDisplayTargets[label]!;
145
- }
146
- }
147
-
148
- const pathTargets = new Map<string, string>();
149
- const displayBase = details?.cwd ?? details?.searchPath;
150
- const rawBase = rawCwd ?? rawSearchPath ?? displayBase;
151
- if (displayBase && rawBase && rawFiles && details?.files) {
152
- for (let index = 0; index < Math.min(details.files.length, rawFiles.length); index++) {
153
- const displayFile = path.resolve(displayBase, details.files[index]!);
154
- const rawFile = path.resolve(rawBase, rawFiles[index]!);
155
- pathTargets.set(displayFile, rawFile);
156
- // Folded directory headers must retain the original path as well.
157
- let displayDir = path.dirname(displayFile);
158
- let rawDir = path.dirname(rawFile);
159
- while (displayDir !== path.dirname(displayDir) && rawDir !== path.dirname(rawDir)) {
160
- pathTargets.set(displayDir, rawDir);
161
- displayDir = path.dirname(displayDir);
162
- rawDir = path.dirname(rawDir);
163
- }
164
- }
165
- }
166
- const target = (displayPath: string): string => {
167
- const known = pathTargets.get(displayPath);
168
- if (known) return known;
169
- if (rawCwd && details?.cwd) return path.resolve(rawCwd, path.relative(details.cwd, displayPath));
170
- return displayPath;
171
- };
172
- return {
173
- target,
174
- searchPath: rawSearchPath ?? details?.searchPath,
175
- fileScope: rawSearchPath ?? details?.searchPath,
176
- displayTargets,
177
- };
178
- }
179
-
180
- function linkUrlLikeSearchHeader(
181
- raw: string,
182
- styled: string,
183
- resolvedPath?: string,
184
- ): { line: string; absPath?: string } {
185
- if (resolvedPath) return { line: fileHyperlink(resolvedPath, styled), absPath: resolvedPath };
186
- return { line: uriHyperlink(raw, styled) };
187
- }
188
-
189
- function parseSearchDisplayLineNumber(line: string): number | undefined {
190
- const match = SEARCH_CODE_FRAME_LINE_RE.exec(line);
191
- if (!match) return undefined;
192
- return Number.parseInt(match[1]!, 10);
193
- }
194
-
195
- const SEARCH_MATCH_LINE_RE = /^\s*\*\d+(?:│|[:|])/;
196
-
197
- function isSearchMatchLine(line: string): boolean {
198
- return SEARCH_MATCH_LINE_RE.test(line);
199
- }
200
-
201
- function isSearchHeaderLine(line: string): boolean {
202
- return /^#+ /.test(line);
203
- }
204
-
205
- const URL_HEADER_PREFIX_RE = /^#+\s+/;
206
-
207
- /**
208
- * Build a memoized per-line styler for search display output. Classification
209
- * and URL-target tracking walk the whole output once (nested directory stacks
210
- * span blank-line groups), but styling and hyperlinking run only for the rows
211
- * a preview actually shows.
212
- */
213
- function createSearchLineStyler(
214
- lines: readonly string[],
215
- headerBase: string | undefined,
216
- fileScope: string | undefined,
217
- uiTheme: Theme,
218
- displayTargets: Record<string, string> | undefined,
219
- target: (displayPath: string) => string,
220
- ): (index: number) => string {
221
- const contexts = classifyGroupedLines(lines, headerBase, fileScope);
222
- const styleCodeFrame = createCodeFrameStyler(lines, contexts, "toolOutput", uiTheme);
223
- // `classifyGroupedLines` can't resolve internal URLs (TUI-only), so track the
224
- // resolved URL target here and use it for the body lines that follow.
225
- const urlRaw: (string | undefined)[] = Array.from({ length: lines.length }, () => undefined);
226
- const urlFiles: (string | undefined)[] = Array.from({ length: lines.length }, () => undefined);
227
- let urlFile: string | undefined;
228
- for (let index = 0; index < lines.length; index++) {
229
- const ctx = contexts[index]!;
230
- if (ctx.kind === "dir") {
231
- urlFile = undefined;
232
- } else if (ctx.kind === "file") {
233
- if (ctx.isUrl) {
234
- const raw = lines[index]!.replace(URL_HEADER_PREFIX_RE, "")
235
- .trimEnd()
236
- .replace(/\s+\([^)]*\)\s*$/, "");
237
- urlRaw[index] = raw;
238
- urlFile = displayTargets?.[raw];
239
- } else {
240
- urlFile = undefined;
241
- }
242
- } else {
243
- urlFiles[index] = urlFile;
244
- }
245
- }
246
- const styledLines: (string | undefined)[] = Array.from({ length: lines.length }, () => undefined);
247
- return index => {
248
- const cached = styledLines[index];
249
- if (cached !== undefined) return cached;
250
- const line = lines[index]!;
251
- const ctx = contexts[index]!;
252
- let styled: string;
253
- if (ctx.kind === "dir") {
254
- const accent = uiTheme.fg("accent", line);
255
- styled = ctx.headerPath ? fileHyperlink(target(ctx.headerPath), accent) : accent;
256
- } else if (ctx.kind === "file") {
257
- const raw = urlRaw[index];
258
- if (raw !== undefined) {
259
- styled = linkUrlLikeSearchHeader(raw, uiTheme.fg("accent", line), displayTargets?.[raw]).line;
260
- } else {
261
- // Root-level files keep the bright accent; nested file headers are dimmed.
262
- const tinted = uiTheme.fg(ctx.depth === 1 ? "accent" : "dim", line);
263
- styled = ctx.headerPath ? fileHyperlink(target(ctx.headerPath), tinted) : tinted;
264
- }
265
- } else {
266
- const tinted = styleCodeFrame(index) ?? uiTheme.fg("toolOutput", line);
267
- const lineNumber = parseSearchDisplayLineNumber(line);
268
- const filePath = ctx.filePath ? target(ctx.filePath) : urlFiles[index];
269
- styled = filePath && lineNumber !== undefined ? fileHyperlink(filePath, tinted, { line: lineNumber }) : tinted;
270
- }
271
- styledLines[index] = styled;
272
- return styled;
273
- };
274
- }
275
-
276
- function compactSearchPreviewGroup(group: readonly number[], lines: readonly string[]): readonly number[] {
277
- const compact = group.filter(index => isSearchHeaderLine(lines[index]!) || isSearchMatchLine(lines[index]!));
278
- return compact.length > 0 ? compact : group;
279
- }
280
-
281
- function countPreviewMatches(group: readonly number[], lines: readonly string[], hasMarkedMatches: boolean): number {
282
- let count = 0;
283
- for (const index of group) {
284
- const line = lines[index]!;
285
- if (hasMarkedMatches ? isSearchMatchLine(line) : !isSearchHeaderLine(line) && line.length > 0) count++;
286
- }
287
- return count;
288
- }
289
-
290
- function renderBudgetedSearchGroups(
291
- groups: readonly (readonly number[])[],
292
- lines: readonly string[],
293
- styleLine: (index: number) => string,
294
- maxLines: number,
295
- matchCount: number,
296
- uiTheme: Theme,
297
- compact: boolean,
298
- ): string[] {
299
- if (maxLines <= 0) return [];
300
- const renderedGroups = groups
301
- .map(group => (compact ? compactSearchPreviewGroup(group, lines) : group))
302
- .filter(group => group.length > 0);
303
- if (renderedGroups.length === 0) return [];
304
-
305
- let totalLines = 0;
306
- let totalMarkedMatches = 0;
307
- let totalFallbackMatches = 0;
308
- for (const group of renderedGroups) {
309
- totalLines += group.length;
310
- totalMarkedMatches += countPreviewMatches(group, lines, true);
311
- totalFallbackMatches += countPreviewMatches(group, lines, false);
312
- }
313
- const hasMarkedMatches = totalMarkedMatches > 0;
314
- const needsSummary = totalLines > maxLines;
315
- const contentBudget = needsSummary ? Math.max(maxLines - 1, 0) : maxLines;
316
- const visibleGroups: (readonly number[])[] = [];
317
- let visibleLineCount = 0;
318
- let visibleMatches = 0;
319
- for (const group of renderedGroups) {
320
- if (visibleLineCount >= contentBudget) break;
321
- const available = contentBudget - visibleLineCount;
322
- const take = Math.min(group.length, available);
323
- if (take <= 0) break;
324
- const visibleGroup = group.slice(0, take);
325
- visibleGroups.push(visibleGroup);
326
- visibleLineCount += visibleGroup.length;
327
- visibleMatches += countPreviewMatches(visibleGroup, lines, hasMarkedMatches);
328
- }
329
-
330
- const totalMatches = hasMarkedMatches ? totalMarkedMatches : Math.max(matchCount, totalFallbackMatches);
331
- const hiddenMatches = Math.max(totalMatches - visibleMatches, 0);
332
- const hiddenLines = Math.max(totalLines - visibleLineCount, 0);
333
- const hasSummary = needsSummary && (hiddenMatches > 0 || hiddenLines > 0);
334
- const out: string[] = [];
335
- for (let i = 0; i < visibleGroups.length; i++) {
336
- const group = visibleGroups[i]!;
337
- const isLast = !hasSummary && i === visibleGroups.length - 1;
338
- const prefix = `${uiTheme.fg("dim", getTreeBranch(isLast, uiTheme))} `;
339
- const continuePrefix = uiTheme.fg("dim", getTreeContinuePrefix(isLast, uiTheme));
340
- out.push(`${prefix}${replaceTabs(styleLine(group[0]!))}`);
341
- for (let j = 1; j < group.length; j++) {
342
- out.push(`${continuePrefix}${replaceTabs(styleLine(group[j]!))}`);
343
- }
344
- }
345
- if (hasSummary) {
346
- const hiddenLabel =
347
- hiddenMatches > 0 ? formatMoreItems(hiddenMatches, "match") : formatMoreItems(hiddenLines, "line");
348
- out.push(`${uiTheme.fg("dim", uiTheme.tree.last)} ${uiTheme.fg("muted", hiddenLabel)}`);
349
- }
350
- return out;
351
- }
352
-
353
101
  function grepStatusIcon(uiTheme: Theme): string {
354
102
  return uiTheme.fg("toolTitle", uiTheme.symbol("icon.search"));
355
103
  }
@@ -422,7 +170,12 @@ export const grepToolRenderer = {
422
170
  },
423
171
  );
424
172
  }
425
- const linkTargets = grepLinkTargets(details, options.renderContext?.rawDetails);
173
+ // The scope label links to the original (unsanitized) search path.
174
+ const rawDetails = options.renderContext?.rawDetails;
175
+ const searchPath =
176
+ isRecord(rawDetails) && typeof rawDetails.searchPath === "string"
177
+ ? rawDetails.searchPath
178
+ : details?.searchPath;
426
179
 
427
180
  const matchCount = details?.matchCount ?? 0;
428
181
  const fileCount = details?.fileCount ?? 0;
@@ -438,7 +191,7 @@ export const grepToolRenderer = {
438
191
 
439
192
  if (matchCount === 0) {
440
193
  const meta = ["0 matches"];
441
- const scopeMeta = searchScopeMeta(details, linkTargets.searchPath);
194
+ const scopeMeta = searchScopeMeta(details, searchPath);
442
195
  if (scopeMeta) meta.push(scopeMeta);
443
196
  const header = renderStatusLine(
444
197
  { icon: "warning", title: "Grep", titleColor: "toolTitle", description: args?.pattern, meta },
@@ -451,7 +204,7 @@ export const grepToolRenderer = {
451
204
 
452
205
  const summaryParts = [formatCount("match", matchCount), formatCount("file", fileCount)];
453
206
  const meta = [...summaryParts];
454
- const scopeMeta = searchScopeMeta(details, linkTargets.searchPath);
207
+ const scopeMeta = searchScopeMeta(details, searchPath);
455
208
  if (scopeMeta) meta.push(scopeMeta);
456
209
  if (truncated) meta.push(uiTheme.fg("warning", "truncated"));
457
210
  const description = args?.pattern ?? undefined;
@@ -468,20 +221,26 @@ export const grepToolRenderer = {
468
221
 
469
222
  const textContent = result.details?.displayContent ?? result.content?.find(c => c.type === "text")?.text ?? "";
470
223
  const allLines = textContent.split("\n");
471
- // Resolve hyperlinks once over the whole output so a nested directory stack
472
- // reconstructs correctly across blank-line group boundaries.
473
- // Header/match display paths are cwd-relative, so resolve them against cwd
474
- // (falling back to searchPath for legacy results that predate `cwd`); the
475
- // scoped file's absolute path seeds body lines in single-file searches.
476
- const styleLine = createSearchLineStyler(
477
- allLines,
478
- details?.cwd ?? details?.searchPath,
479
- linkTargets.fileScope,
480
- uiTheme,
481
- linkTargets.displayTargets,
482
- linkTargets.target,
483
- );
484
- const matchGroups = groupLineIndicesByBlank(allLines);
224
+ // Classify the whole output so nested directory headers resolve across blank-line
225
+ // groups. Display paths are cwd-relative (`searchPath` for results that predate
226
+ // `cwd`); a single-file search's headerless lines belong to the searched file.
227
+ const contexts = classifyGroupedLines(allLines, details?.cwd ?? details?.searchPath, details?.searchPath);
228
+ const styleCodeFrame = createCodeFrameStyler(allLines, contexts, "toolOutput", uiTheme);
229
+ const styleLine = createGroupedRowStyler(allLines, contexts, uiTheme, {
230
+ linkTarget: groupedLinkTargets(contexts, textContent, details, rawDetails),
231
+ styleBody: index => styleCodeFrame(index) ?? uiTheme.fg("toolOutput", allLines[index]!),
232
+ linkLines: true,
233
+ });
234
+ const matchGroups = groupsByFile(groupLineIndicesByBlank(allLines), contexts);
235
+ // Output without `*` match marks (legacy results) counts its body rows as matches.
236
+ const marked = allLines.some(isMatchRow);
237
+ const isMatch = marked
238
+ ? (index: number) => isMatchRow(allLines[index]!)
239
+ : (index: number) => contexts[index]!.kind === "content" && allLines[index]!.length > 0;
240
+ // Collapsed previews drop context rows, keeping each file row and its matches.
241
+ const compactGroups = marked
242
+ ? matchGroups.map(group => group.filter(index => contexts[index]!.kind === "file" || isMatch(index)))
243
+ : matchGroups;
485
244
 
486
245
  const extraLines: string[] = [];
487
246
  if (missingNote) extraLines.push(missingNote);
@@ -489,18 +248,15 @@ export const grepToolRenderer = {
489
248
  return createCachedComponent(
490
249
  () => options.expanded,
491
250
  width => {
492
- const budget = Math.max(
493
- (options.expanded ? EXPANDED_TEXT_LIMIT : COLLAPSED_TEXT_LIMIT) - extraLines.length,
494
- 0,
251
+ const limit = options.expanded ? EXPANDED_TEXT_LIMIT : COLLAPSED_TEXT_LIMIT;
252
+ const { shown, summary } = fitGroupsToBudget(
253
+ options.expanded ? matchGroups : compactGroups,
254
+ Math.max(limit - extraLines.length, 0),
255
+ { isUnit: isMatch, unit: "match", total: matchCount },
495
256
  );
496
- const matchLines = renderBudgetedSearchGroups(
497
- matchGroups,
498
- allLines,
499
- styleLine,
500
- budget,
501
- matchCount,
257
+ const matchLines = renderTreeList(
258
+ { items: shown, trailingSummary: summary, renderItem: group => group.map(styleLine) },
502
259
  uiTheme,
503
- !options.expanded,
504
260
  );
505
261
  return fitHeaderedRows(header, [...matchLines, ...extraLines], width);
506
262
  },