From db683485dcf4665116a545768ff758c4167a63ea Mon Sep 17 00:00:00 2001 From: cpacker Date: Sun, 26 Oct 2025 18:07:04 -0700 Subject: [PATCH] fix: patch the deny dialogs to use the pasteaware input --- src/cli/components/ApprovalDialogRich.tsx | 17 ++++++----------- src/cli/components/PlanModeDialog.tsx | 20 +++++++++----------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/cli/components/ApprovalDialogRich.tsx b/src/cli/components/ApprovalDialogRich.tsx index 368871f..8cec968 100644 --- a/src/cli/components/ApprovalDialogRich.tsx +++ b/src/cli/components/ApprovalDialogRich.tsx @@ -1,12 +1,13 @@ // Import useInput from vendored Ink for bracketed paste support import { Box, Text, useInput } from "ink"; -import RawTextInput from "ink-text-input"; import { type ComponentType, memo, useMemo, useState } from "react"; import type { ApprovalContext } from "../../permissions/analyzer"; import { type AdvancedDiffSuccess, computeAdvancedDiff } from "../helpers/diff"; +import { resolvePlaceholders } from "../helpers/pasteRegistry"; import type { ApprovalRequest } from "../helpers/stream"; import { AdvancedDiffRenderer } from "./AdvancedDiffRenderer"; import { colors } from "./colors"; +import { PasteAwareTextInput } from "./PasteAwareTextInput"; type Props = { approvalRequest: ApprovalRequest; @@ -247,7 +248,9 @@ export function ApprovalDialog({ if (isEnteringReason) { // When entering reason, only handle enter/escape if (key.return) { - onDeny(denyReason); + // Resolve placeholders before sending denial reason + const resolvedReason = resolvePlaceholders(denyReason); + onDeny(resolvedReason); } else if (key.escape) { setIsEnteringReason(false); setDenyReason(""); @@ -358,15 +361,7 @@ export function ApprovalDialog({ {"> "} - {(() => { - const TextInputAny = RawTextInput as unknown as ComponentType<{ - value: string; - onChange: (s: string) => void; - }>; - return ( - - ); - })()} + diff --git a/src/cli/components/PlanModeDialog.tsx b/src/cli/components/PlanModeDialog.tsx index f5bf85b..5dfffb8 100644 --- a/src/cli/components/PlanModeDialog.tsx +++ b/src/cli/components/PlanModeDialog.tsx @@ -1,8 +1,9 @@ import { Box, Text, useInput } from "ink"; -import RawTextInput from "ink-text-input"; import { type ComponentType, memo, useState } from "react"; +import { resolvePlaceholders } from "../helpers/pasteRegistry"; import { colors } from "./colors"; import { MarkdownDisplay } from "./MarkdownDisplay"; +import { PasteAwareTextInput } from "./PasteAwareTextInput"; type Props = { plan: string; @@ -55,7 +56,9 @@ export const PlanModeDialog = memo( if (isEnteringReason) { // When entering reason, only handle enter/escape if (key.return) { - onKeepPlanning(denyReason); + // Resolve placeholders before sending reason + const resolvedReason = resolvePlaceholders(denyReason); + onKeepPlanning(resolvedReason); setIsEnteringReason(false); setDenyReason(""); } else if (key.escape) { @@ -98,15 +101,10 @@ export const PlanModeDialog = memo( {"> "} - {(() => { - const TextInputAny = RawTextInput as unknown as ComponentType<{ - value: string; - onChange: (s: string) => void; - }>; - return ( - - ); - })()} +