Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/toad/hint_labels.py
Original file line number Diff line number Diff line change
@@ -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"):
Expand Down
2 changes: 1 addition & 1 deletion src/toad/widget_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/model/test_hint_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
4 changes: 2 additions & 2 deletions tests/textual/test_hint_label_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading