Issue details
Backspace does not delete in the fields of the /mcp add server form. It appends the raw byte to the field, so the field shows a stray escape and the value that gets saved can contain a control character.
Steps to reproduce on fx 0.0.14 (macOS, TERM=xterm-256color):
- Run
fx. - Run
/mcp. - Press
ato open the add server form. - Type
abin the Name field. - Press Backspace.
Expected: the field shows a.
Actual: the field shows ab followed by a control byte, and nothing is deleted. Holding or repeating Backspace keeps appending bytes until the field overflows and renders with an ellipsis.
The same happens in the Command field, with Ctrl-H (0x08) as well as Backspace (0x7f), and in the Arguments field, which shares the code path. Backspace works in the main prompt, in the /mcp filter field (/), and in the /model picker search, so the problem is limited to the MCP add and argument forms.
Impact: the control byte becomes part of the field value. The add form writes those values to the server entry, so a field edited with Backspace can store a control character in ~/.fx/mcp.json. It also breaks the ordinary editing flow of the form, because there is no way to correct a typo.
Cause, from reading main:
handleMcpAddInputandhandleMcpArgumentInputinsrc/core/app/app_input_runtime.zigspecial-case\tand\rand send every other byte tohandleTextByte, which appends it to the composer draft.- The terminal decoder has already resolved the byte into a
composer_shortcut(.delete_backwardfor 127 and 8 insrc/ui/input/shortcuts.zig), but these two handlers receive only the byte and never the shortcut. - The MCP filter field in the same file handles
0x7fexplicitly, which is why the filter deletes correctly.
I reproduced this with FX_RECORD and have a fix with a regression test ready to open as a pull request.
Trace
No response
Sensitive information
- I reviewed the information above and removed secrets and other sensitive data.
Activity
0No activity yet.