Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anwser is duplicated to new line #982

Open
gbaranski opened this issue Dec 1, 2020 · 7 comments
Open

Anwser is duplicated to new line #982

gbaranski opened this issue Dec 1, 2020 · 7 comments

Comments

@gbaranski
Copy link

Screenshot 2020-12-02 at 00 05 45

As you can see everything is duplicated, my setup

OS: macOS Big Sur 11.0.1 20B29 x86_64
Shell: zsh 5.8 with oh-my-zsh
Terminal: iTerm2
Node: v15.2.1
import inquirer from "inquirer";

enum AuthChoice {
  login,
  register,
}

interface UserCredentials {
  username: string;
  password: string;
}

export const getCredentials = (): Promise<UserCredentials> => {
  return inquirer.prompt<UserCredentials>([
    {
      type: "input",
      message: "Enter username",
      name: "username",
    },
    {
      type: "password",
      message: "Enter password, at least 8 characters long",
      name: "password",
      mask: "*",
      validate: (val) =>
        val.length >= 8 ? true : "Password must be at least 8 characters long",
    },
  ]);
};

export const runAuth = async () => {
  const { choice } = await inquirer.prompt<{ choice: AuthChoice }>([
    {
      type: "list",
      message: "Authorization required",
      name: "choice",
      choices: [
        { name: "Log in to existing account", value: AuthChoice.login },
        { name: "Create new account", value: AuthChoice.register },
      ],
    },
  ]);
  const credentials = await getCredentials();
};

runAuth();
@aoping
Copy link

aoping commented Dec 9, 2020

me too

@aoping
Copy link

aoping commented Dec 9, 2020

my case is the question will be duplicated when the answer is overflow

image

@LeftoverChineseFood
Copy link

LeftoverChineseFood commented Mar 4, 2021

yeah they were gonna fix this with #239, but the guy who owns the repo decided to not do it. smh...

don't expect a fix soon, because the fix was suppossed to come years ago.

i also have this problem.

@paulmiller3000
Copy link

I also have this issue.

@LitoMore
Copy link
Collaborator

Does this reproduce in our sample code?

@gbaranski Could you give it a try with the sample code?

@xutaocc
Copy link

xutaocc commented Sep 28, 2021

image

// me too

// This problem exists in both Chinese and English. The old version also has this problem

// This problem occurs when the paste exceeds the terminal width

How to deal with this problem

@xutaocc
Copy link

xutaocc commented Sep 28, 2021

var inquirer = require('inquirer');

var questions = [{
type: 'input',
message: 'thisTip中文',
name: 'gitHashStr',
default: "hello world中文"
},
];

inquirer.prompt(questions).then(answers => {
console.log(JSON.stringify(answers, null, ' '));
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants