Skip to content

Fix SelectionPrompt search failing with bracket characters#2059

Closed
1PetarVujakovic wants to merge 6 commits into
spectreconsole:mainfrom
1PetarVujakovic:fix-selectionprompt-brackets
Closed

Fix SelectionPrompt search failing with bracket characters#2059
1PetarVujakovic wants to merge 6 commits into
spectreconsole:mainfrom
1PetarVujakovic:fix-selectionprompt-brackets

Conversation

@1PetarVujakovic
Copy link
Copy Markdown
Contributor

Fixes #1653

  • I have read the Contribution Guidelines
  • I have checked that there isn't already another pull request that solves the above issue
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors

Changes

Fix an issue where searching in SelectionPrompt would throw an exception when choices contained bracket characters like "[]".

The text was not properly escaped before being rendered as markup, which caused the markup parser to fail.

This change ensures that the text is safely escaped before rendering.

A unit test was added to reproduce and verify the behavior.

@JamesNK
Copy link
Copy Markdown

JamesNK commented Mar 25, 2026

Is this issue related to #2055?

@1PetarVujakovic
Copy link
Copy Markdown
Contributor Author

Is this issue related to #2055?

Yeah, looks related. I added the fix in SelectionPrompt by escaping the text before rendering. If #2055 already covers this at a lower level, this might be redundant.

@patriksvensson
Copy link
Copy Markdown
Contributor

Wouldn't this PR prevent markup from being used at all in list items? Or am I misunderstanding something?

@patriksvensson
Copy link
Copy Markdown
Contributor

Closing this until merge conflicts are resolved and things are building. Feel free to re-open once this is done 👍

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.

Search not working on the selectionprompt if you have [] characters in your string.

3 participants