fix: track vimEnabled changes in status line triggers

When vim mode is toggled off, vimMode stays the same but the status
line should stop including vim data. Use effectiveVim (undefined when
disabled) as the tracked value instead of raw vimMode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wenshao 2026-04-06 11:39:25 +08:00
parent c219f7c4ac
commit 24251db4ef

View file

@ -110,14 +110,15 @@ export function useStatusLine(): {
// does not fire redundantly on mount.
const { lastPromptTokenCount } = uiState.sessionStats;
const { currentModel } = uiState;
const effectiveVim = vimEnabled ? vimMode : undefined;
const prevStateRef = useRef<{
promptTokenCount: number;
currentModel: string;
vimMode: string | undefined;
effectiveVim: string | undefined;
}>({
promptTokenCount: lastPromptTokenCount,
currentModel,
vimMode,
effectiveVim,
});
// Guard: when true, the mount effect has already called doUpdate so the
@ -209,18 +210,18 @@ export function useStatusLine(): {
if (
lastPromptTokenCount !== prev.promptTokenCount ||
currentModel !== prev.currentModel ||
vimMode !== prev.vimMode
effectiveVim !== prev.effectiveVim
) {
prev.promptTokenCount = lastPromptTokenCount;
prev.currentModel = currentModel;
prev.vimMode = vimMode;
prev.effectiveVim = effectiveVim;
scheduleUpdate();
}
}, [
statusLineCommand,
lastPromptTokenCount,
currentModel,
vimMode,
effectiveVim,
scheduleUpdate,
]);