console-rs / dialoguer

Rust utility library for nice command line prompts and similar things

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to change selection of a Select in certain terminals.

simon-wh opened this issue · comments

I have a bit of a weird issue that I'm not sure how to approach. I started using dialoguer for some simple CLI Selects for a small CLI tool.
The code I use is very close to the examples:

  let choice = Select::with_theme(&ColorfulTheme::default())
                .with_prompt("Pick a device, any device")
                .default(0)
                .items(devices.iter().as_slice())
                .interact_opt()
                .unwrap();

However, it works as expected in some terminals and not others. When it doesn't work, I'll try and navigate, the prompt flickers (indicating a re-render) but the selection doesn't actually change.

What works:

  • Warp
  • Visual Studio Code integrated terminal

What doesn't work:

  • iTerm2
  • Visual Studio Code for Web integrated terminal (vscode.dev)

It failing on VSCode for Web would kinda be fair enough, as it's not your standard terminal set-up. But I was quite confused why iTerm2 wasn't working properly

It's a little bit annoying as it means I have to have an additional terminal open on the side just for running certain commands.

Any assistance on this would be appreciated

Aside: I switched to dialoguer from youchoose to improve Windows compatibility for my tool. For what it's worth, I never had this issue with it