tmbo / questionary

Python library to build pretty command line user prompts ✨Easy to use multi-select lists, confirmations, free text prompts ...
MIT License
1.53k stars 87 forks source link

Newline `\n` in message breaks line wrap in terminal #398

Open sisp opened 2 weeks ago

sisp commented 2 weeks ago

Describe the bug

When using the newline character \n in the question's message, then a long message does not get wrapped according to the terminal width anymore. In my case, we add a trailing newline character to the message to always receive the answer in the next line.

This is a screenshot of the unwrapped message:

screenshot

The behavior has been verified on Linux (Ubuntu 22.04, GNU bash 5.1.16) and macOS.

Example

import questionary

questionary.text(message="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua\n.").ask()

Steps to reproduce

No response

Expected behaviour

Line wrap should work despite newline characters \n in the message.

Latest version

Questionary version

2.0.1

Prompt Toolkit version

3.0.36

Operating System

Linux