Skip to content

Native Vim hints share left/context published-cell activation - #204

Merged
trissim merged 1 commit into
mainfrom
work/toad-keymap--P888--textual
Oct 28, 2026
Merged

trissim merged 1 commit into
mainfrom
work/toad-keymap--P888--textual

Conversation

@trissim

@trissim trissim commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

5 source modules changed; 156 added / 25 removed at the first source checkpoint. One native hint operation becomes two click intents sharing the same acquisition, session and retirement. Zero ToAD popup registries, compatibility aliases, tests, fixtures or dependency pins added. Paired with OpenHCSDev/toad#1305 on P888; keep draft and unarmed pending root review of both heads.

Before / after

  • Before: HintHost.action_show_hints owned both f and ctrl+f, but both activated left-click effects. After: the SAME primary callable keeps f; action_show_context_hints owns ctrl+f. Both call one _show_hints implementation. HintClick.LEFT=1/RIGHT=3 owns descriptions and the transient Escape caption rendered by HintSession itself. No notification or global title state.
  • Before: DOMNode.primary_activation_targets was the only declaration boundary. After: DOMNode.activation_targets(region, meta, button=1) selects the existing primary capability or the new default-empty contextual capability. Activation.from_paint and Compositor.activation_targets(button=1) use the SAME exposed published-cell walk, nearest declaring ancestor and identity de-duplication. Default calls remain left-click.
  • Before: PrimaryTarget could only invoke no-argument callbacks. After: the one CallbackTarget supplies keyword-only arguments, but identity remains (widget, bound_callback), never the painted offset. PrimaryActivation still supplies its existing callable with no arguments; ContextActivation supplies its bound contextual method and published offset. The old private name and its only constructor reference are deleted, not aliased.
  • Before: StyleTarget discarded click intent by passing no event. After: it calls dispatch_style_action exactly once with a modifier-free Click carrying the selected button, current style, and absolute/relative published placement. It does not post another click. Existing availability and decoded-handler equality checks remain; hyperlink identity remains the decoded handler action. ToAD's existing ToadApp.dispatch_style_action still owns left/open versus right/copy-menu.
  • Before: OptionList published numeric option metadata but hint acquisition ignored it. After: option_from_meta is the list's shared decoder for physical click, hover, hint acquisition and revalidation. OptionActivation retains the actual Option object; identity is list+Option. Membership and enabled state are answered by option_enabled; the current exposed cell must still decode to that SAME Option. A removed/reordered/disabled/offscreen item cannot select a different index occupant. Pointer and hint activation share select_option (highlight plus existing action_select), so ordinary OptionSelected/subclass behavior remains owned by the list. Divider and blank cells have no option marker and contribute no target. Both click intents retain OptionList's existing either-button selection behavior.

Binding identities and focus

textual.widgets._hints.HintHost.action_show_hints is unchanged. Its saved per-mode suffixes remain :textual.document._editing.VimInsert, :textual.document._editing.VimNormal, and :textual.document._editing.VimVisual. The new contextual identity is textual.widgets._hints.HintHost.action_show_context_hints with the same existing mode-derived suffix mechanism. MODE_BINDINGS remains the native/F1 declaration owner. Native custom remaps, BindingsMap precedence, editor consumption and terminal priority are unchanged; no saved settings are rewritten.

The session still owns prefix, labels, original focus and retirement. Caption space participates in existing label placement. Screen suspend, resize, blur and selection still retire sessions through their existing owners. Restoration now refuses a focus widget moved to a different screen. No popup-specific lifecycle or persistent ToAD state is added.

Source evidence and scope

Read the supplied p888-hint-owner-census.json at ToAD 5fa29f3770a040af4686ede11f8584c6646d55c0 and Textual c27e535fe2f05406de3c9e90ac61352f59815bca. Its actual header says 2,065 modules, zero parse errors, not the 877 quoted in the order. Followed the named declarations and consumers in both owned checkouts, plus Core source, using whole-tree rg; retained source closures are /home/ts/.cache/agent-scratch/toad-keymap/p888-hints-source-closure-before.txt and p888-hints-source-closure-after.txt in the same directory. This is static source evidence, not a claim of dynamic resolution or live behavior.

IMPL-4: fact=published options have their existing selection effect; at=old _activation.py:39 / _option_list.py:722,804; derive=base-method; by=OptionList's metadata/selection owner. The missing native capability is implemented instead of adding a ToAD menu registry. IDEN-2: one hint method used to stand for both requested click intents; each callable now has one meaning.

Known producer family: _get_option_render emits the option index on content/padding; SelectionList's render_line emits that same marker on its toggle gutter. The divider emits none. The numeric paint format is unchanged, including ToAD SelectionOptionList's existing hover consumer. OptionSelected continues through native SelectionList/Select/command-list and ToAD menu owners; no synthetic result or menu index roster was added.

Verification / remaining qualification

  • python -m py_compile completed with exit 0 for all five native modules and ToAD's CommsRow module.
  • Source imports completed with exit 0 using /home/ts/.local/share/agent-comms/current/bin/python and PYTHONPATH pointing at BOTH owned source roots. Imported CallbackTarget, ContextActivation, PrimaryActivation, StyleTarget, HintClick/Host/Session, OptionActivation/List and ToAD CommsRow. No application was instantiated or started. The first optional import used Core's shared venv and stopped immediately on missing rich; that attempt was not counted as a pass. No environment or installed package was changed.
  • No automated tests, new test files, test edits, checker/ratchet/profiling run, synthetic application, UI automation, provider input, service operation or installation by this unit.
  • Root alone owes installed saved-session qualification: both hint intents on thread/channel rows and actual menus; visible/enabled/scroll-clipped options; current modal; Escape/focus; removed targets; saved remaps; Insert typing; links open/copy; original F1 Left absent/bound-mode crash. The source pair does not claim the 16ms performance target.

Assumed: root accepts and lands Textual before the paired ToAD change, combines sibling Textualize#1303 without dropping its paint/availability work, retains Textualize#1304's eventual DeclaredField import migration, and owns all further test caller work and live acceptance.

_hints.py:27: two keys entered, one left click left. The menu was not shy; the collector had forgotten to invite OptionList.

@trissim
trissim marked this pull request as ready for review October 28, 2026 17:26
Copilot AI balanced review requested due to automatic review settings October 28, 2026 17:26
@trissim
trissim merged commit 965e920 into main Oct 28, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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