faressoft / inquirer-checkbox-plus-prompt

Checkbox with autocomplete and other additions for Inquirer
MIT License
39 stars 25 forks source link

Up Arrow key tries history, re-filters list. #3

Open zjr opened 5 years ago

zjr commented 5 years ago

If I have a checkbox prompt open, type in "foo" then go about my business, everything is fine.

If I then run the prompt later, type in "bar" and try to scroll upwards w/ the up arrow key, I am getting history put into the search.

I'm running bash on MacOS.

Would love to look into this myself, but not sure I'll have the time any day soon.

zWingz commented 3 years ago

can you resolved it @zjr ?

zjr commented 3 years ago

No, sorry @zWingz.

zWingz commented 3 years ago

@zjr

import Base from 'inquirer/lib/prompts/base';

export class ClearHistory extends Base {
  constructor(questions: any, rl: any, answers: any) {
    super(questions, rl, answers);
   // clear readline history
    rl.history = [];
  }
}

create a new plugin to clear readline history, ant it work