Skip to content

Commit

Permalink
simplify prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Mar 10, 2022
1 parent 91e0146 commit 568b951
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions rich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -1995,23 +1995,15 @@ def input(
Returns:
str: Text read from stdin.
"""
prompt_str = ""
if prompt:
with self.capture() as capture:
self.print(prompt, markup=markup, emoji=emoji, end="")
prompt_str = capture.get()
if self.legacy_windows:
# Legacy windows doesn't like ANSI codes in getpass or input (colorama bug)?
self.file.write(prompt_str)
prompt_str = ""
self.print(prompt, markup=markup, emoji=emoji, end="")
if password:
result = getpass(prompt_str, stream=stream)
result = getpass("", stream=stream)
else:
if stream:
self.file.write(prompt_str)
result = stream.readline()
else:
result = input(prompt_str)
result = input()
return result

def export_text(self, *, clear: bool = True, styles: bool = False) -> str:
Expand Down

0 comments on commit 568b951

Please sign in to comment.