@@ -119,6 +119,9 @@ def prompt(
119119 show_choices is true and text is "Group by" then the
120120 prompt will be "Group by (day, week): ".
121121
122+ .. versionchanged:: 8.3.1
123+ A space is no longer appended to the prompt.
124+
122125 .. versionadded:: 8.0
123126 ``confirmation_prompt`` can be a custom string.
124127
@@ -138,10 +141,10 @@ def prompt_func(text: str) -> str:
138141 try :
139142 # Write the prompt separately so that we get nice
140143 # coloring through colorama on Windows
141- echo (text . rstrip ( " " ) , nl = False , err = err )
142- # Echo a space to stdout to work around an issue where
144+ echo (text [: - 1 ] , nl = False , err = err )
145+ # Echo the last character to stdout to work around an issue where
143146 # readline causes backspace to clear the whole line.
144- return f (" " )
147+ return f (text [ - 1 :] )
145148 except (KeyboardInterrupt , EOFError ):
146149 # getpass doesn't print a newline if the user aborts input with ^C.
147150 # Allegedly this behavior is inherited from getpass(3).
@@ -214,6 +217,9 @@ def confirm(
214217 :param err: if set to true the file defaults to ``stderr`` instead of
215218 ``stdout``, the same as with echo.
216219
220+ .. versionchanged:: 8.3.1
221+ A space is no longer appended to the prompt.
222+
217223 .. versionchanged:: 8.0
218224 Repeat until input is given if ``default`` is ``None``.
219225
@@ -231,10 +237,10 @@ def confirm(
231237 try :
232238 # Write the prompt separately so that we get nice
233239 # coloring through colorama on Windows
234- echo (prompt . rstrip ( " " ) , nl = False , err = err )
235- # Echo a space to stdout to work around an issue where
240+ echo (prompt [: - 1 ] , nl = False , err = err )
241+ # Echo the last character to stdout to work around an issue where
236242 # readline causes backspace to clear the whole line.
237- value = visible_prompt_func (" " ).lower ().strip ()
243+ value = visible_prompt_func (prompt [ - 1 :] ).lower ().strip ()
238244 except (KeyboardInterrupt , EOFError ):
239245 raise Abort () from None
240246 if value in ("y" , "yes" ):
0 commit comments