Skip to content
Open
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 rich/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def on_validate_error(self, value: str, error: InvalidResponse) -> None:
value (str): String entered by user.
error (InvalidResponse): Exception instance the initiated the error.
"""
self.console.print(error)
self.console.print(error, markup=True)

def pre_prompt(self) -> None:
"""Hook to display something before the prompt."""
Expand Down
13 changes: 13 additions & 0 deletions tests/test_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,16 @@ def test_prompt_confirm_default():
output = console.file.getvalue()
print(repr(output))
assert output == expected


def test_prompt_confirm_markup():
INPUT = "foo\nNO\ny"
console = Console(file=io.StringIO(), markup=False)
answer = Confirm.ask(
"continue", console=console, stream=io.StringIO(INPUT), default=True
)
assert answer is True
expected = "continue [y/n] (y): Please enter Y or N\ncontinue [y/n] (y): Please enter Y or N\ncontinue [y/n] (y): "
output = console.file.getvalue()
print(repr(output))
assert output == expected