Skip to content

Commit d249193

Browse files
🤖 fix: show correct keybind for stopping auto-retry (#865)
The RetryBarrier button was hardcoded to show 'Stop (Ctrl+C)' but Ctrl+C only works in vim mode. Non-vim mode (default) uses Escape. Now reads vim mode from persisted state and displays the correct keybind using `formatKeybind()`. - **Non-vim mode** (default): Shows "Stop (Esc)" - **Vim mode**: Shows "Stop (Ctrl+C)" _Generated with `mux`_
1 parent 44964a3 commit d249193

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/browser/components/Messages/ChatBarrier/RetryBarrier.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState, useEffect, useMemo } from "react";
22
import { usePersistedState, updatePersistedState } from "@/browser/hooks/usePersistedState";
3-
import { getRetryStateKey, getAutoRetryKey } from "@/common/constants/storage";
3+
import { getRetryStateKey, getAutoRetryKey, VIM_ENABLED_KEY } from "@/common/constants/storage";
4+
import { KEYBINDS, formatKeybind } from "@/browser/utils/ui/keybinds";
45
import { CUSTOM_EVENTS, createCustomEvent } from "@/common/constants/events";
56
import { cn } from "@/common/lib/utils";
67
import type { RetryState } from "@/browser/hooks/useResumeManager";
@@ -33,6 +34,12 @@ export const RetryBarrier: React.FC<RetryBarrierProps> = ({ workspaceId, classNa
3334
{ listener: true }
3435
);
3536

37+
// Read vim mode for displaying correct stop keybind
38+
const [vimEnabled] = usePersistedState<boolean>(VIM_ENABLED_KEY, false, { listener: true });
39+
const stopKeybind = formatKeybind(
40+
vimEnabled ? KEYBINDS.INTERRUPT_STREAM_VIM : KEYBINDS.INTERRUPT_STREAM_NORMAL
41+
);
42+
3643
// Use persisted state for retry tracking (survives workspace switches)
3744
// Read retry state (managed by useResumeManager)
3845
const [retryState] = usePersistedState<RetryState>(
@@ -149,7 +156,7 @@ export const RetryBarrier: React.FC<RetryBarrierProps> = ({ workspaceId, classNa
149156
className="border-warning font-primary text-warning hover:bg-warning-overlay cursor-pointer rounded border bg-transparent px-4 py-2 text-xs font-semibold whitespace-nowrap transition-all duration-200 hover:-translate-y-px active:translate-y-0 disabled:cursor-not-allowed disabled:opacity-50"
150157
onClick={handleStopAutoRetry}
151158
>
152-
Stop (Ctrl+C)
159+
Stop ({stopKeybind})
153160
</button>
154161
</div>
155162
{lastError && (

0 commit comments

Comments
 (0)