mokkabonna / inquirer-autocomplete-prompt

Autocomplete prompt for inquirer
ISC License
350 stars 82 forks source link

feat: Add transformOnAutoComplete option #118

Closed maxluchterhand1 closed 3 years ago

maxluchterhand1 commented 3 years ago

I added the option "transformOnAutoComplete" because I am using this module for path auto-completion. The transformOnAutoComplete option allows me to append a '/' to the auto-completed user input in case the path is a directory, but it could certainly be used for other things as well. In case the transformOnAutoComplete option is used, another auto-completion attempt is made using the new, transformed input.

The reason I added the line 'this.rl.write(ansiEscapes.cursorForward());' is because there has been a bug where the cursor would not move the specified amount of columns if the auto-completion contained special characters like '.' or '/'. In those cases, the cursor would be moved in the middle of the auto-completed input. I have no idea why my "fix" works, but adding this line resolved the issue.