feat(run): a Find entry on every console, not just the Run toolbar (#1764)

Console search exists (⌘F, the magnifier in a Run tab's toolbar), but a console without a
toolbar of its own — a stack-trace tab, say — offered no visible way in: the shortcut only
worked once the output had focus, and nothing said so.

Every uncontrolled ConsoleView now shows a small Find button over the output's top-right
corner, opening the same find bar (query, match count, Enter/Shift+Enter, case and regex
options). Consoles whose find bar a toolbar drives keep exactly one entry: the toolbar's.

How it was verified:
- pnpm vitest run src/features/run/findBar.test.tsx: 9 passed, including a new test that
  the button opens the find bar and focuses its input.
- pnpm typecheck.
Цей коміт міститься в:
misswell authored and GitHub committed 2026-11-09 14:29:23 +08:00
1 джерело c5c5930a75
коміт 89b178f9aa
3 files changed
+45

No files matched your search

+13
Переглянути файл
@@ -498,6 +498,19 @@ export function ConsoleView({
const items = virtualizer.getVirtualItems();
return (
<div className={styles.consoleWrap}>
{/* A console whose find bar is not driven by a toolbar (a stack-trace tab, say) still
needs a visible way in: the same Find the Run toolbar offers, over the output. */}
{controlledFindOpen === undefined && !findOpen && (
<button
type="button"
className={styles.consoleFindOpen}
title="Find…"
aria-label="Find in console"
onClick={() => setFindOpen(true)}
>
<Icon name="search" size={14} />
</button>
)}
{findOpen && (
<ConsoleFindBar
query={query}
+25
Переглянути файл
@@ -81,7 +81,32 @@
/* Console */
.consoleFindOpen {
position: absolute;
top: 6px;
right: 14px;
z-index: 2;
display: inline-flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
padding: 0;
border: none;
border-radius: 4px;
color: var(--fg-secondary);
background: var(--bg-toolbar);
opacity: 0.6;
}
.consoleFindOpen:hover,
.consoleFindOpen:focus-visible {
opacity: 1;
color: var(--fg-primary);
}
.consoleWrap {
position: relative;
flex: 1;
display: flex;
flex-direction: column;
+7
Переглянути файл
@@ -44,6 +44,13 @@ function markCount(container: HTMLElement) {
}
describe("Run console find", () => {
it("offers a visible Find entry in a console without a toolbar (stack traces)", () => {
setup();
fireEvent.click(screen.getByRole("button", { name: "Find in console" }));
expect(screen.getByRole("search")).toBeInTheDocument();
expect(input()).toHaveFocus();
});
it("opens on ⌘F, searches as you type and highlights every match", () => {
const { log, view } = setup();
const bar = openFind(log);