Repository navigation
text inputs: Delete, Home and End in prompt, login and settings add - #129
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Text inputs: Delete, Home and End in the prompt, login and settings add
Problem
Pressing
Deletein the main prompt did nothing, while the same key worked inthe
^Rthread rename. The terminal side is fine: maya'sInputParserdecodesDelete (
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,HomeandEnd. Threecaret-based text inputs had gaps. This PR closes them.
Audit: every text input you can type into (caret-based editing)
Before this PR:
subscribe.cppon_composersubscribe.cppon_thread_listform_keys.cppsubscribe.cppon_loginsubscribe.cppon_settings_list* 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 lastcharacter, 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 toui::chip_next(), theforward mirror of Backspace's
chip_prev, so Delete in front of anattachment 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 textstates differ only in the name of their text member, so a local
with_login_field()visits them once and hands(text, caret)to eachoperation. The existing Backspace/Left/Right reducers are untouched.
SettingsListDelete,SettingsListCursor{Left,Right,Home,End}: routedthrough
NavSpec::extrawhile the add prompt is open, the same shape as thethread-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.cppadds one case per surface. Each drives the realAgenttyApp::on -> updatepath, including a 2-byte code point, and for theprompt an attachment chip.
Verification
devandreleaseprofiles. ctest passes 100%.g++ -fsyntax-onlywith the flags frombuild-release/compile_commands.jsonpasses on
subscribe.cpp,update/composer.cpp,update/login.cpp,update/settings_list.cppandinit.cpp(the TU where the panelparts_cover_allcheck fires).