Repository navigation
Finish central key declarations across Toad consumers - #1338
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
687fb7d to
b5298c9
Compare
|
Rescue of review-p917 (P975): the unit stopped mid-rebase of this branch onto c59b376 with uncommitted src edits, now saved as claude-nra/rescue-review-p917 @ ccc2115 (4 rebased commits + the edits). The edits move the Menu claims onto Menu.keymap_claims and make KeymapCatalog call owner.keymap_claims(mode). They import textual.binding.KeymapClaim and DOMNode.keymap_claims, which no OpenHCSDev/textual commit declares yet, so the branch is not buildable or reviewed. The unresolved pyproject/uv.lock rebase conflict is in commander scratch (rescue/review-p917). Whoever picks this up next starts from that branch. 🤖 Generated with Claude Code |
76a8f45 to
eba46da
Compare
…tral-declarations # Conflicts: # src/toad/keymap.py
…tral-declarations # Conflicts: # uv.lock
…r expansion ExpansionCommand restated the overlap check ExclusiveKeys already owns (widget_actions.py:177), so it now inherits the mixin and the copied issubclass goes. test_block_menu_and_copy imported the deleted MenuItem and failed at collection; its extra block now declares a keyed command. tests/textual/test_block_menu_and_copy.py: 2 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mports menus.py imported Conversation, Menu, ToolCall and LineLink only under TYPE_CHECKING. Conversation and Menu now inherit MenuConversation and MenuOwner, which state what a command may ask of them. LineLink is a real import. CollapseCommand and ExpandCommand move to BlockContent, which owns the methods they call. The session and navigation check, and the link route through the transcript, move onto Conversation behind accepts_menu_owner and open_line_link. Delete present_navigation_binding: no parent defines it and nothing calls it. Action.declarations narrows the native registry's type to the family asking. MenuOption inherits ToadNode to see the application's settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
settings.ui.key_mode is already a class. type() of it handed menu_keys the metaclass, so the row asked a metaclass for its binding mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation ConversationSessionBinding already owns is_current_session and reads the transcript. Navigation and the two menu answers move there, so Conversation shrinks instead of growing by two forwarding methods. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
action_cursor_up and action_cursor_down were one walk written twice. move_row owns it, matching the layout's size and the reactive highlight once, where those foreign absent values arrive. The back-to-bottom check matches the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuConversation and Conversation no longer spell block operations action_*: nothing reaches them by name. MovesCursor's methods are a contract its key family calls, so the keymap guard derives that exemption from Textual's class and its ceiling falls from 46 to 36. The message-link guard now asks the declared commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9440565 deleted the j and k review keys on the permissions screen as "derived from the shared key family", but that family only holds up and down. Restore the declarations and press them in a test. Delete Conversation.action_focus_block, ToolCall.action_collapse and action_expand, OpensMessageNames with LineHistory.message_row and the destination property: only menu action strings reached them, and commands now capture their operation. Delete CommsRow's CursorCommand scope and Menu and Question's signal unsubscribes, which Textual does on close. BlockCursor.export_to_svg replaces export_render's None: a no-op on the base, an override on the one cursor that draws a block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Untangles Toad's key bindings: 23 commits, 32 files, +540/-337. Block menus stop being strings, up/down come from one native cursor family, and every menu key shows up in the keymap and can be remapped.
Block menus
Before:
MenuItem("Copy thinking", "block.copy", "y"), a label, an action string and a key.Menu.on_keymatched keys by hand, andrun_actionresolved the string at click time.block.copyhad no target at all, so "Copy thinking" did nothing.After:
MenuCommandis a declared family inmenus.py. Each command is a class that owns its description and key and captures what it acts on (CollapseCommand(block),OpenSenderCommand(link)).Menu.keymap_claimsreports the keys to the keymap,MenuOption.refresh_keydraws the live key, andMenuConversationdeclares what a command may ask of its conversation.Cursor keys
Before:
toad.widget_actions.CursorAction,MovesCursor,SelectionUpAction/SelectionDownAction, andTargetTreeMember.cursor_upforwarding to its tree.After:
textual.navigation.MovesCursorand itsCursorCommandfamily. Controls implementaction_cursor_up/down. Tree rows no longer forward: the key reachesTargetTreethrough the binding chain.GridSelecthas onemove_rowin place of two copied walks.Other bindings
WorkspaceScreenescape moves fromcheck_actionstring dispatch to aModeBindingwithavailable=.WelcomeScreen'snmoves to aModeBinding.KeymapCatalogreadsKeymapClaims.Deleted
MenuItem,Menu.on_key,present_navigation_binding,Action.declarations' hand walk, the local cursor families,ProjectDirectoryTree'sctrl+cbinding (it named an action the tree doesn't have),Conversation.action_focus_block,ToolCall.action_collapse/expand,OpensMessageNames,LineHistory.message_row,MessageRow.destination,BlockCursor.export_render'sNone(nowexport_to_svg, a no-op on the base with an override on the cursor that draws a block). Guard ceiling for string-foundaction_*methods: 46 to 36.Bug the review caught
944056540deletedj/kon the permissions screen while claiming to derive them from the shared family, which only holds up and down. All tests stayed green because none pressedj. Restored, with a test that presses them from the question.Evidence
Open
Action.declarationsinwidget_actions.pyis a forwarder that exists only to narrow a type. The owner fix isKeyDeclaration.declarationsattextual/keys.py:137.WorkspaceFrame.back_to_bottom_windowstill answers withNone, whichback_to_bottom_availableandaction_back_to_bottomboth test.🤖 Generated with Claude Code