Skip to content

Commit

Permalink
fixed prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Saif807380 committed Apr 6, 2021
1 parent b625b9f commit 9d90c4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Unreleased
applications to translate Click's built-in strings. :issue:`303`
- Writing invalid characters to ``stderr`` when using the test runner
does not raise a ``UnicodeEncodeError``. :issue:`848`

- Fixed ``click.prompt()`` not working with ``readline`` module. :issue:`665`

Version 7.1.2
-------------
Expand Down
4 changes: 2 additions & 2 deletions src/click/termui.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def prompt_func(text):
try:
# Write the prompt separately so that we get nice
# coloring through colorama on Windows
echo(text, nl=False, err=err)
return f("")
echo(text.rstrip(" "), nl=False, err=err)
return f(" ")
except (KeyboardInterrupt, EOFError):
# getpass doesn't print a newline if the user aborts input with ^C.
# Allegedly this behavior is inherited from getpass(3).
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def f(_):
click.echo("Screw you.")

out, err = capsys.readouterr()
assert out == "Password: \nScrew you.\n"
assert out == "Password:\nScrew you.\n"


def _test_gen_func():
Expand Down Expand Up @@ -255,8 +255,8 @@ def emulate_input(text):
emulate_input("asdlkj\n")
click.prompt("Prompt to stderr", err=True)
out, err = capfd.readouterr()
assert out == ""
assert err == "Prompt to stderr: "
assert out == " "
assert err == "Prompt to stderr:"

emulate_input("y\n")
click.confirm("Prompt to stdin")
Expand Down

0 comments on commit 9d90c4c

Please sign in to comment.