Skip to content

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

@sisp

Description

@sisp

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

  • I have checked that this issue occurs on the latest version of questionary.

Questionary version

2.0.1

Prompt Toolkit version

3.0.36

Operating System

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions