prompt-toolkit / prompt-toolkit/python-prompt-toolkit

"radiolist focused" versus "radio-list focused" or perhaps a bug in RadioList focusing?

Open
#1,211 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

I'm not sure if this is a question or a bug report. The file examples/full-screen/full-screen-demo.py has an app style that includes:
"radiolist focused": "noreverse",
"radiolist focused radio.selected": "reverse",

Where as the prompt_toolkit.widgets.base.RadioList class has:
container_style = "class:radio-list"
default_style = "class:radio"
selected_style = "class:radio-selected"
checked_style = "class:radio-checked"

That container_style's use of 'radio-list' rather than 'radiolist' has me wondering if the example's code should include a hyphen. I tried changing example to use 'radio-list' instead of 'radiolist on those two lines, but I didn't see any visible difference. I did some debugging in prompt_toolkit.styles.style.Style.get_attrs_for_style_str and didn't observe a match occur that resulted in that function's local variable list_of_attrs being appended too. I tried that debuggin with both "radiolist focused" and "radio-list focused". But, since the only combos I observed that included 'radio' did not included 'focused', perhaps focused isn't handled here. This is my first delve into styles, so I'm not sure were all of the relevant code is, and very well may have missed something.

In turn, I'm not certain if I'm asking "How is this supposed to work?" or reporting that something isn't working or that there is some superfluous code in that sample.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/full-screen/full-screen-demo.py and prompt_toolkit.widgets.base.RadioList, then trace style matching through prompt_toolkit.styles.style.Style.get_attrs_for_style_str. Compare the radiolist and radio-list selectors and check how focused styles are applied. Done means determining whether the example selector is intentional or correcting it with a test or clearly documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.