[Bug] MCP setup wizard's custom-server "environment variables" field has no Backspace/Delete handling
Description
Every free-text entry point elsewhere in the app (the shared TextInput component, filterable select lists, model selection) handles key.backspace || key.delete. The MCP setup wizard's hand-rolled multiline buffer for a custom server's envVars field does not it only handles Return (newline) and Escape (submit); any other keypress, including Backspace, falls into an append-only branch that does nothing useful with it. The field is effectively append-only for its entire lifetime.
Parent: #907
Steps to Reproduce
- Run
/settings mcp→ select "Configure MCP Servers" → "+ Add an MCP server…" → (accept default config location) → "Add MCP servers" → scroll down to "Custom MCP Server" and select it. - Step through Transport / Server name / URL / Command / Args (accepting defaults or skipping is fine) until reaching "Environment variables (KEY=VALUE, one per line, optional)".
- Type a value with a typo, e.g.
API_KEY=abc123X. - Press Backspace repeatedly to remove the trailing typo.
Expected Behavior
Backspace removes the last character, same as every other text field in the app.
Actual Behavior
Nothing happens. Pressing Backspace 5 times in a row against API_KEY=abc123X leaves the field reading exactly API_KEY=abc123X, typo included. The only way out is Escape (submits the value with the typo still in it) or Shift+Tab all the way back which also clears the buffer entirely (setMultilineBuffer('')), so there's no partial-edit recovery either.
Recording
Root Cause
source/wizards/steps/mcp-step.tsx:398-411:
const isMultiline = currentField?.name === 'envVars';
if (isMultiline) {
if (key.return) {
setMultilineBuffer(multilineBuffer + '\n');
} else if (key.escape) {
handleFieldSubmit();
} else if (!key.ctrl && !key.meta && input) {
setMultilineBuffer(multilineBuffer + input);
}
}
There is no key.backspace || key.delete branch, unlike the rest of the codebase's consistent pattern for text entry.
Suggested Fix
Add a branch before the generic append case: else if (key.backspace || key.delete) { setMultilineBuffer(multilineBuffer.slice(0, -1)); } (with reasonable handling for deleting across a \n boundary).
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs on the latest
main
Hey @akramcodez, this looks interesting to me, and I’d be happy to take it up if you’re okay with assigning it to me : )