console-rs / dialoguer

Rust utility library for nice command line prompts and similar things
MIT License
1.31k stars 143 forks source link

Multiselect deletes lines when changing selection #227

Open dnlmlr opened 1 year ago

dnlmlr commented 1 year ago

Description

When moving the selection in a multiselect, the whole selection block moves upwards in the terminal, eating everything above. This is not always happening and I can't quite figure out what exactly triggers it, although I think it has something to do with the screen buffer size of the terminal.

The code I'm using in the example is pretty straight forward (the projects implement Display and produce the text seen in the GIF):

dialoguer::MultiSelect::new()
        .items(&projects)
        .with_prompt("Select projects to clean")
        .report(false)
        .defaults(&preselected_projects)
        .interact_opt() else {
            println!("Nothing selected");
            return;
        };

Environment

Recording of what is happening

WindowsTerminal_RRusCfWPnv