Skip to content

Commit

Permalink
Merge pull request #2044 from Textualize/ansi-to-win32
Browse files Browse the repository at this point in the history
simplify prompt
  • Loading branch information
willmcgugan authored Mar 10, 2022
2 parents c2b0e32 + 568b951 commit 8c6d1cd
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 8c6d1cd

Please sign in to comment.