Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(prompt.py): #2994 #3558

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [13.9.4]

### Fixed

- Fixed importing readline breaks rich prompt alignement [#2994](https://github.com/Textualize/rich/issues/2994)

## [13.9.4] - 2024-11-01

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ The following people have contributed to the development of Rich:
- [Arian Mollik Wasi](https://github.com/wasi-master)
- [Jan van Wijk](https://github.com/jdvanwijk)
- [Handhika Yanuar Pratama](https://github.com/theDreamer911)
- [Tianyu Yuan](https://github.com/paperplane110)
- [za](https://github.com/za)
- [Motahhar Mokfi](https://github.com/motahhar)
- [Tomer Shalev](https://github.com/tomers)
Expand Down
3 changes: 3 additions & 0 deletions rich/prompt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from typing import Any, Generic, List, Optional, TextIO, TypeVar, Union, overload

from . import get_console
Expand Down Expand Up @@ -290,6 +291,8 @@ def __call__(self, *, default: Any = ..., stream: Optional[TextIO] = None) -> An
self.pre_prompt()
prompt = self.make_prompt(default)
value = self.get_input(self.console, prompt, self.password, stream=stream)
if ("readline" in sys.modules) and (value == ""):
print("")
if value == "" and default != ...:
return default
try:
Expand Down