console-rs / dialoguer

Rust utility library for nice command line prompts and similar things

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In tmux session content is pasted multiple times

mkon opened this issue · comments

Hello, thanks for this nice crate!

I think i found some weird side effect when using prompts in a tmux session.

I am using dialoguer to prompt for an authenticator token like this:

Input::new().with_prompt("Enter the code").interact_text().unwrap()

When i copy&paste an authenticator OTP into the prompt it is working fine when on a shel like zsh directly. However when in a tmux session it seems like it is pasted multiple times. But it is not actually the same string multiple times, it pasted the correct string only the first time, and seems to "create" 21 characters from a 6 digit OTP by repeatedly pasting the string but always leaving some new characters from the front.

For example if i paste the string 123456 it will insert 123456234563456456566. Also it is not possible to delete characters from the prompt fully.

I can reproduce this on MacOS with both default Terminal and Alacritty.

Workaround: use .interact() instead of .interact_text().