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

Session specific prompt method parameters are overwriting prompt session parameters across prompt method calls. #1916

Open
not-sekiun opened this issue Sep 22, 2024 · 0 comments

Comments

@not-sekiun
Copy link

When creating a prompt session and calling for prompts through the session's prompt method, prompt call-specific parameters can be passed to the method that can overwrite whatever parameters were passed to the session. However, this seems to overwrite the session parameters and not be scoped to that specific method call. Example:

import prompt_toolkit


session = prompt_toolkit.PromptSession()
session.prompt("(1) Enter single line input: ")
session.prompt("(2) Enter multiline input: ", multiline=True)
session.prompt("(3) Enter single line input again: ")
session.prompt("(4) Enter single line input once more: ", multiline=None)

The first and second prompt calls work as specified. However the third and fourth are still multiline inputs. I would expect that the third and fourth prompts be singleline inputs because they do not specify the multiline parameter. However it appears that the multiline parameter passed in the second prompt call is overwriting the session and causing the third and fourth to erroneously be multiline inputs despite them not specifying so at all. This isn't limited just to the multiline parameter it appears other parameters like bottom_toolbar suffer from this unusual behaviour as well.

Is this behaviour a bug or is it intentional? If it is intentional I would still propose changing it because of how unintuitive it is. Parameters should be limited per prompt call and should not affect or overwrite other prompt calls even for the same session.

Note: This behaviour also affects Session.prompt_async

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant