Skip to content

text inputs: Delete, Home and End in prompt, login and settings add - #129

Merged
1ay1 merged 1 commit into
agentty-org:masterfrom
sail3r:fix/text-input-edit-keys
Nov 15, 2026
Merged

1ay1 merged 1 commit into
agentty-org:masterfrom
sail3r:fix/text-input-edit-keys

Conversation

@sail3r

@sail3r sail3r commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Text inputs: Delete, Home and End in the prompt, login and settings add

Problem

Pressing Delete in the main prompt did nothing, while the same key worked in
the ^R thread rename. The terminal side is fine: maya's InputParser decodes
Delete (CSI 3~, KKP 57365) and Home/End (CSI H/F, SS3 H/F, CSI 1~/4~).
The key reached the agentty router, matched no case, and was dropped.

I audited every input surface for Backspace, Delete, Home and End. Three
caret-based text inputs had gaps. This PR closes them.

Audit: every text input you can type into (caret-based editing)

Before this PR:

Surface Where the keys are read Backspace Delete Home End
Main prompt subscribe.cpp on_composer yes, erases an attachment chip whole missing yes* yes*
Threads ^R rename subscribe.cpp on_thread_list yes yes yes yes
All form panes: Retrieval, Smart mode, Web search, Paste, Plugin edit, Appearance, Sandbox, Sandbox list form_keys.cpp yes yes yes yes
Login: OAuth code, API key, custom host subscribe.cpp on_login yes missing missing missing
Settings lists (Plugins/Commands/Agents/Hooks), "add" prompt subscribe.cpp on_settings_list yes missing missing missing

* Home and End jump to the start and end of the whole prompt, not the current
line of a multi-line prompt. Unchanged by this PR.

The Settings "add" prompt also kept a caret (and rendered it with with_caret)
but handled neither Left nor Right, so it could only type and erase at the end.

After this PR, every row above reads "yes" in all four columns, and the
Settings "add" prompt also answers Left/Right.

Not text inputs, and unchanged: the type-at-the-end search boxes (^K palette,
@-mention, symbols, models, providers, thread search, settings search, theme
search, the tool-output / find) have no caret, so Backspace erases the last
character, Home/End move through the list, and Delete has nothing to do. In the
provider picker and login account list, Delete means "remove the row" (press
twice).

Changes

  • ComposerDeleteForward: erases from the caret to ui::chip_next(), the
    forward mirror of Backspace's chip_prev, so Delete in front of an
    attachment placeholder removes the whole chip. The caret stays put, and the
    change is one undo unit (begin_edit), as with Backspace.
  • LoginDelete, LoginCursorHome, LoginCursorEnd: the three login text
    states differ only in the name of their text member, so a local
    with_login_field() visits them once and hands (text, caret) to each
    operation. The existing Backspace/Left/Right reducers are untouched.
  • SettingsListDelete, SettingsListCursor{Left,Right,Home,End}: routed
    through NavSpec::extra while the add prompt is open, the same shape as the
    thread-list rename.

All deletes step by whole UTF-8 code points and do nothing at the end of the
text.

Tests

tests/key_routing_test.cpp adds one case per surface. Each drives the real
AgenttyApp::on -> update path, including a 2-byte code point, and for the
prompt an attachment chip.

Verification

  • builds with no errors to dev and release profiles. ctest passes 100%.
  • by-hand tests were made in the UI and verified to function
  • g++ -fsyntax-only with the flags from build-release/compile_commands.json
    passes on subscribe.cpp, update/composer.cpp, update/login.cpp,
    update/settings_list.cpp and init.cpp (the TU where the panel
    parts_cover_all check fires).

maya's InputParser already decodes Delete (CSI 3~, KKP 57365) and
Home/End (CSI H/F, SS3 H/F, CSI 1~/4~), and the forms and the ^R thread
rename consume them. Three caret-based text inputs did not, so the key
reached the router, matched no arm, and was silently dropped:

- Main prompt (on_composer): no Delete arm. New ComposerDeleteForward
  erases from the caret to ui::chip_next(), the forward mirror of
  ComposerBackspace's chip_prev, so Delete in front of an attachment
  placeholder removes the whole chip in one stroke. The caret stays
  put; begin_edit() makes it one undo unit, as Backspace does.

- Login text fields (OAuth code, API key, custom host): no Delete,
  Home or End arms. New LoginDelete / LoginCursorHome / LoginCursorEnd.
  The three states differ only in the name of their text member, so a
  local with_login_field() visits them once and hands (text, caret) to
  each operation; the existing Backspace/Left/Right reducers are left
  as they were.

- Settings list one-line add prompt (n, or a on Commands/Agents): kept
  a byte caret and rendered it with with_caret, but routed only
  printables and Backspace through the shared nav grammar, so there was
  no way to move the caret, and Home/End fell through to the list's
  jump verbs (a no-op while adding). New SettingsListDelete and
  SettingsListCursor{Left,Right,Home,End}, routed through NavSpec::extra
  in the same shape as the thread-list rename.

All deletes step by whole UTF-8 code points (utf8_next), and are no-ops
at the end of the text.

Tests (key_routing_test.cpp) drive the real AgenttyApp::on -> update
path for each surface, including a 2-byte code point and, for the
prompt, an attachment chip.
@1ay1
1ay1 merged commit f3c0aca into agentty-org:master Nov 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants