Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions apps/web/src/chatFindStore.ts

This file was deleted.

53 changes: 17 additions & 36 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ import {
} from "../types";
import { useTheme } from "../hooks/useTheme";
import { writeTextToClipboard } from "../hooks/useCopyToClipboard";
import { useChatFindStore } from "../chatFindStore";
import { isCommandPaletteOpen } from "../commandPaletteBus";
import { subscribeSnapShotComposerFocus } from "../lib/desktopSnapShot";
import { useMediaQuery } from "../hooks/useMediaQuery";
Expand All @@ -260,9 +259,8 @@ import {
type RightPanelSurface,
useRightPanelStore,
} from "../rightPanelStore";
import { activeChatPaneId, useIsActiveChatPane } from "./split/chatPane";
import { ChatFindHeaderButton } from "./chatFind/ChatFindHeaderButton";
import { UPSTREAM_THREAD_FIND_ENABLED } from "./chatFind/upstreamThreadFind";
import { useIsActiveChatPane } from "./split/chatPane";
import { ThreadFindHeaderButton } from "./chatFind/ThreadFindHeaderButton";
import { installDesktopClipboardPasteFallback } from "../lib/desktopClipboardPaste";
import {
isPreviewSupportedInRuntime,
Expand Down Expand Up @@ -8238,12 +8236,7 @@ export default function ChatView(props: ChatViewProps) {
}

// Drafts and servers without thread search leave Mod+F to the browser.
if (
command === "chat.find" &&
UPSTREAM_THREAD_FIND_ENABLED &&
isServerThread &&
serverConfig?.threadFind === true
) {
if (command === "chat.find" && isServerThread && serverConfig?.threadFind === true) {
event.preventDefault();
event.stopPropagation();
openThreadFind();
Expand Down Expand Up @@ -8354,22 +8347,6 @@ export default function ChatView(props: ChatViewProps) {
return;
}

if (command === "chat.find") {
// The file editor has its own find, a modal owns the keyboard while
// open, and a maximized panel hides the timeline the bar would search.
if (
rightPanelMaximized ||
(event.target instanceof Element &&
event.target.closest(".file-preview-virtualizer, [role=dialog]") !== null)
) {
return;
}
event.preventDefault();
event.stopPropagation();
if (!event.repeat) useChatFindStore.getState().show(activeChatPaneId());
return;
}

if (command === "modelPicker.toggle") {
event.preventDefault();
event.stopPropagation();
Expand Down Expand Up @@ -8517,7 +8494,6 @@ export default function ChatView(props: ChatViewProps) {
onInterrupt,
onToggleDiff,
pinThread,
rightPanelMaximized,
settleThread,
supportsPinning,
supportsSettlement,
Expand Down Expand Up @@ -11517,12 +11493,20 @@ export default function ChatView(props: ChatViewProps) {
onToggleRightPanel: toggleRightPanel,
} satisfies PanelLayoutControlsProps;
const panelToggleControls = (
// Fork: find in thread sits in front of the panel toggles; an empty draft
// and a maximized panel have no timeline to search.
// Fork: find in thread sits in front of the panel toggles; a maximized
// panel hides the timeline it searches.
<span className="flex h-full shrink-0 items-center gap-1">
{rightPanelMaximized || isDraftHeroState ? null : (
<ChatFindHeaderButton shortcutLabel={shortcutLabelForCommand(keybindings, "chat.find")} />
)}
{isServerThread &&
serverConfig?.threadFind === true &&
!paintOnlyDisplayedTimeline &&
!rightPanelMaximized ? (
<ThreadFindHeaderButton
open={isThreadFindActive}
onOpen={openThreadFind}
onClose={closeThreadFind}
shortcutLabel={shortcutLabelForCommand(keybindings, "chat.find")}
/>
) : null}
<PanelLayoutControls
{...panelToggleControlProps}
showThreadPanelControl={!inlineRightPanelOwnsTitleBar}
Expand Down Expand Up @@ -11671,10 +11655,7 @@ export default function ChatView(props: ChatViewProps) {
progressive: serverConfig?.threadFindProgressive === true,
thread: activeThreadRef,
enabled:
UPSTREAM_THREAD_FIND_ENABLED &&
isServerThread &&
serverConfig?.threadFind === true &&
!paintOnlyDisplayedTimeline,
isServerThread && serverConfig?.threadFind === true && !paintOnlyDisplayedTimeline,
content: serverProjection ?? undefined,
}}
controlsRef={threadFindControlsRef}
Expand Down
23 changes: 1 addition & 22 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ import {
SettingsIcon,
SquarePenIcon,
SunIcon,
SearchIcon,
TextSearchIcon,
} from "lucide-react";
import { requestThreadFindOpen } from "./chat/threadFindActionBus";
import { UPSTREAM_THREAD_FIND_ENABLED } from "./chatFind/upstreamThreadFind";
import {
useCallback,
useDeferredValue,
Expand Down Expand Up @@ -156,7 +154,6 @@ import {
onOpenCommandPalette,
takePendingProjectPick,
} from "../commandPaletteBus";
import { useChatFindStore } from "../chatFindStore";
import { isPreviewFocused } from "../lib/previewFocus";
import { isTerminalFocused } from "../lib/terminalFocus";
import {
Expand Down Expand Up @@ -243,7 +240,6 @@ import {
import { resolveShortcutCommand, threadJumpIndexFromCommand } from "../keybindings";
import { CommandDialog, CommandDialogPopup, CommandFooterAction } from "./ui/command";
import { revealThreadInSplit } from "./split/splitPanes";
import { activeChatPaneId } from "./split/chatPane";
import { Button } from "./ui/button";
import { Kbd, KbdGroup } from "./ui/kbd";
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "./ui/select";
Expand Down Expand Up @@ -1100,7 +1096,6 @@ function OpenCommandPaletteDialog(props: {
[activeThread, navigate],
);
const supportsThreadFind =
UPSTREAM_THREAD_FIND_ENABLED &&
environments.find((environment) => environment.environmentId === activeThread?.environmentId)
?.serverConfig?.threadFind === true;
const currentProjectEnvironmentId =
Expand Down Expand Up @@ -2034,21 +2029,6 @@ function OpenCommandPaletteDialog(props: {
});
}

if (activeThread !== null) {
actionItems.push({
kind: "action",
value: "action:find-in-thread",
searchTerms: ["find", "search", "thread", "conversation", "messages", "text", "ctrl+f"],
title: "Find in thread",
icon: <SearchIcon className={ITEM_ICON_CLASS} />,
shortcutCommand: "chat.find",
run: async () => {
// Fork: find opens in the active split pane; upstream calls `show()`.
useChatFindStore.getState().show(activeChatPaneId());
},
});
}

if (
activeThread !== null &&
threadPullRequestLinkMode(activeThreadServerConfig?.environment.capabilities) !== "unsupported"
Expand Down Expand Up @@ -3264,8 +3244,7 @@ function OpenCommandPaletteDialog(props: {
event.preventDefault();
event.stopPropagation();
setOpen(false);
if (UPSTREAM_THREAD_FIND_ENABLED) requestThreadFindOpen();
else useChatFindStore.getState().show(activeChatPaneId());
requestThreadFindOpen();
return;
}

Expand Down
Loading