From 739c061c8f797d4110649067e7947c9b92ec637c Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Mon, 16 Nov 2026 16:04:07 -0500 Subject: [PATCH] Hint label choices compose formbridge's hint label styles toad.hint_labels and widget_actions import HintLabelStyle and its members from formbridge.hint_keys; tests read the style's shown() answer and HintLabel.caption. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn --- src/toad/hint_labels.py | 2 +- src/toad/widget_actions.py | 2 +- tests/model/test_hint_labels.py | 4 ++-- tests/textual/test_hint_label_setting.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/toad/hint_labels.py b/src/toad/hint_labels.py index be9910012f..2ffc1ea7f9 100644 --- a/src/toad/hint_labels.py +++ b/src/toad/hint_labels.py @@ -1,6 +1,6 @@ """Saved hint-label choices compose Textual's native presentation.""" from agent_comms.nominal.declared_choice import DeclaredChoice, TitledChoice -from textual.hint_labels import FullKeyHints, HintLabelStyle, NextLetterHints +from formbridge.hint_keys import FullKeyHints, HintLabelStyle, NextLetterHints class HintLabels(DeclaredChoice, HintLabelStyle, affix="HintLabels"): diff --git a/src/toad/widget_actions.py b/src/toad/widget_actions.py index 5c7aa0b3fb..45d38c537c 100644 --- a/src/toad/widget_actions.py +++ b/src/toad/widget_actions.py @@ -19,7 +19,7 @@ from textual.binding import Binding, BindingsMap, CommandBinding, ModeBinding from textual.document._editing import VimMode from textual.dom import DOMNode -from textual.hint_labels import HintLabelStyle +from formbridge.hint_keys import HintLabelStyle from formbridge.navigation_commands import SelectCursor from textual.navigation import MovesCursor, MovesHorizontalCursor from textual.widgets import TextArea diff --git a/tests/model/test_hint_labels.py b/tests/model/test_hint_labels.py index 0c728761fa..258a4e5686 100644 --- a/tests/model/test_hint_labels.py +++ b/tests/model/test_hint_labels.py @@ -7,9 +7,9 @@ def test_hint_labels_default_to_next_letter_and_save_the_full_key_choice(): settings = SavedSettings({}) assert settings.current.ui.hint_labels is NextLetterHintLabels - assert settings.current.ui.hint_labels.caption("as", "a") == "s" + assert settings.current.ui.hint_labels.shown("as", "a") == ("s", 0) settings.set(SETTINGS.ui.hint_labels, FullKeyHintLabels) reopened = SavedSettings(settings.document()) assert reopened.current.ui.hint_labels is FullKeyHintLabels - assert reopened.current.ui.hint_labels.caption("as", "a") == "as" + assert reopened.current.ui.hint_labels.shown("as", "a") == ("as", 1) assert {FamilyChoices(HintLabels).label(choice) for choice in FamilyChoices(HintLabels).choices()} == {"Next letter", "Full key"} diff --git a/tests/textual/test_hint_label_setting.py b/tests/textual/test_hint_label_setting.py index 27ef6195fc..caa4767232 100644 --- a/tests/textual/test_hint_label_setting.py +++ b/tests/textual/test_hint_label_setting.py @@ -2,7 +2,7 @@ import json from textual.widgets import Static -from textual.widgets._hints import HintSession +from textual.widgets._hints import HintLabel, HintSession from toad.hint_labels import HintLabels from toad.preferences import SETTINGS, SavedSettings @@ -39,7 +39,7 @@ async def test_hint_picker_saves_and_drives_both_native_presentations(workspace) assert session.label_style is choice label = next(label for label in session.labels if label.target.widget is body) assert len(label.text) == 2 - assert label.render().plain == choice.caption(label.text, "") + assert label.render().plain == HintLabel.caption(choice, label.text, "").plain await pilot.press(*label.text) await ui.until_shows("Hint choice activated") assert ui.draft() == draft