mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Add an opt-in vi command mode to the composer prompt ([ui].commandmode = "vi"). At the prompt Esc enters command mode for navigation and editing rather than interrupting a turn; command mode owns the keys h l j k 0 $ ^ i a x I A p D and the mode switch. The composer lives in internal/frontend/tui, so the mode is implemented there against its textarea: vimode.go carries the command-mode keys and the mode switch, input.go routes keys through it, and ask.go and prompts.go keep Esc from dismissing an open question card or deciding an approval card. Command mode consumes any key carrying printable text, so a CJK/IME character is eaten rather than inserted. Because the interrupt key now depends on the composer mode, the running-turn hint can no longer name a fixed key: with ui.commandmode off Esc stops a running turn, while in vi mode only ^C interrupts, since Esc is a mode switch whether or not a turn runs. The thinking status line therefore names the key that actually interrupts — "(Esc cancels)" or "(Ctrl+C cancels)" — across en/zh/zh-TW, and the footer names the composer's input mode, NORMAL in command mode and INSERT otherwise. The cancelling line drops its "Ctrl+C exits" hint in vi mode, where Ctrl+C re-cancels instead of exiting, and the approval, ask and plan card hints — plus the plan choice list — drop their Esc mention there, where Esc is ignored. At the prompt, ^C with a non-empty prompt clears it and leaves shell mode, in vi mode and out. In vi mode it first saves the trimmed draft to the cmdline history when there is one, as send() does, so an accidental interrupt never loses it (Up recalls it); a whitespace-only prompt is cleared without being saved. In vi mode Esc no longer decides an approval or ask card, where it is pressed out of habit; a row key or Ctrl+C decides instead, and Ctrl+C still cancels a running turn even while an ask answer is being typed. [ui].commandmode is user-global only: a project reasonix.toml cannot set it, so a cloned repo never rebinds the user's keys.