Skip to content

Confirmation prompt: non-last line of multiline strings get printed twice #165

@grunweg

Description

@grunweg

Thanks for this crate, by the way. I could insert a simple terminal prompt without knowing too much about terminals!

Steps to reproduce.
Take this small test programm.

[package]
name = "dialoguer-bug"
version = "0.1.0"
edition = "2021"
[dependencies]
dialoguer = "0.9.0"

$ cat src/main.rs
fn main() {
    let _ = dialoguer::Confirm::new().with_prompt("Prompt string with multiple lines:\nLine two?").interact().map_err(|e| e.to_string());
}
  1. Build and run the programm: cargo r
  2. A confirmation prompt appears:

Prompt string with multiple lines:
Line two?

  1. Answer either yes or no (doesn't matter which).
  2. My answer is displayed in the terminal.

Expected result The terminal output looks like this:

Prompt string with multiple lines:
Line two yes

Actual result The prompt is printed twice, resulting in output like this.

Prompt string with multiple lines:
Prompt string with multiple lines:
Line two yes

Meta. Tested on both version 0.9 and 0.8 of dialoguer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions