Repository navigation
Scroll, text-editing and link keys are declared operations, not action names - #244
Merged
Merged
Conversation
…n names
Toad's keymap guard tolerated 9 `def action_*` methods reached by string name; every one was
an override of a Textual operation Textual itself only reached by a string:
- ScrollableContainer's ten BINDINGS ("scroll_up", "page_down", ...) become the ScrollCommand
family in textual.navigation. The ten action bodies move out of Widget into ScrollsView, the
contract Widget inherits; ScrollableContainer declares key_families=(ScrollCommand,).
PageUp/PageDown are ListCommand and ScrollCommand at once: one key, one operation.
- Navigable is the root a node answering navigation commands needs, so Widget can inherit the
scroll contract without Navigation breaking every (MovesCursor, Widget) MRO.
- TextArea's twelve string BINDINGS become MethodBinding.declare on the methods they run.
The ctrl+k kill action stops choosing an action name in a string and awaiting run_action;
it calls its three operations directly, synchronously.
- A style's handler meta can carry a StyleAction object; HandlerArguments decodes the meta
once into one, and the string form is ParsedAction. Markdown links carry a MarkdownLink, and
the three action_link copies (block, table cell, table content) become one contract,
OpensMarkdownLinks.open_link.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. Try requesting a review at a lower effort level.
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.
trissim
added a commit
to OpenHCSDev/toad
that referenced
this pull request
Nov 6, 2026
Every KeymapMeasure asserts zero and `ceiling` is gone: a tolerated count of keys written outside their owner was a ratchet on slop. ActionMethods exempts exactly the operations Textual declares (a navigation contract's methods, a MethodBinding's), read from the classes. With OpenHCSDev/textual#244, the eleven `def action_*` sites are operations, not names: HistoryWindow overrides ScrollsView, TargetTree implements MovesHorizontalCursor, the prompt overrides TextArea's declared editing methods. The two link actions are deleted: - a drawn link's style meta carries OpenLineLink(link), a StyleAction in the new toad/link_click.py; LineLink.click and its "open" action name leave line_blocks, which declares that nothing in it imports a frontend; - OpensLinks inherits Textual's OpensMarkdownLinks, and open_link decodes a toad-link href once; the right-click menu reads OpenLineLink.link_of, and the app's inline import is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
1 commit, 8 files, +216/-209. Three of Textual's string-dispatched key protocols become declared families. That lets Toad's keymap guard go from "9 tolerated" to 0 (companion Toad PR follows).
Scroll keys
ScrollableContainer.BINDINGShad tenBinding("up", "scroll_up", …)strings reachingWidget.action_scroll_*by name. Toad'sHistoryWindowoverrode five of those names.ScrollCommandfamily intextual.navigation(ScrollUp/Down/Left/Right/Home/End,PageLeft/PageRight).PageUpandPageDownareListCommandandScrollCommandat once, one key and one operation rather than a second pair. The ten bodies move fromWidgetintoScrollsView, the contractWidgetinherits.ScrollableContainerdeclareskey_families=(ScrollCommand,), and itsBINDINGSand the docstring table restating them are deleted.Navigable(DOMNode)now ownsaccepts_navigation/apply_navigation. HangingScrollsViewunderNavigationmade every(MovesCursor, Widget)class unlinearizable.Text editing
BINDINGSbecome@MethodBinding.declare(...)on the methods they run, the same mechanism its cursor keys already use.action_delete_to_end_of_line_or_delete_linewasasynconly toawait self.run_action(action), withactiona string picked by anifchain (IMPL-1). It now callsaction_delete_line/action_delete_right/action_delete_to_end_of_linedirectly.Links
textual.actions.StyleAction: a style's handler meta can carry the operation itself.HandlerArguments.decodeis the one boundary, and the string form becomesParsedAction.MarkdownLink(href)instead off"link({href!r})". The threeaction_linkcopies (MarkdownBlock,MarkdownTableCellContents,MarkdownTableContent, IMPL-12) become one contract,OpensMarkdownLinks.open_link.Proof
tests/text_area/test_editor_state.pyreds fail identically on clean main.tests/test_markdown.py:237pinned the old string meta. It now assertsMarkdownLink.🤖 Generated with Claude Code