Skip to content

Commit 20a1d9d

Browse files
committed
autocomplete match different style
1 parent 871df91 commit 20a1d9d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "awesome-logging",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Advanced logging messages, interactive prompts, loading animations and more in TypeScript",
55
"main": "./lib/index.js",
66
"exports": {

src/prompt/models/text-prompt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class AwesomeTextPromt
8787

8888
let answerText: string;
8989
if (cursorRendered) {
90-
answerText = this._currentAnswer;
90+
answerText = chalk.gray(this._currentAnswer);
9191
} else {
9292
// The cursor needs to be able to be located one character after the entered test, therefor we need to add a space at the end in case the cursor is at the end.
9393
// If fuzzy match is activated there is text rendered after the actual user input. To prevent it from jumping around the additional space char is always rendered.
@@ -112,11 +112,11 @@ export class AwesomeTextPromt
112112
const match = this.findPartialMatch(this._currentAnswer, this._hints);
113113
if (match) {
114114
if (this._cursorPos < this._currentAnswer.length || this._cursorPos === match.length) {
115-
autoCompleteMatch = chalk.gray(match.substring(this._currentAnswer.length));
115+
autoCompleteMatch = chalk.blue(match.substring(this._currentAnswer.length));
116116
} else {
117117
const relativeCurserPos = this._cursorPos - this._currentAnswer.length;
118118
const autoCompletePart = match.substring(this._currentAnswer.length);
119-
autoCompleteMatch = chalk.gray(
119+
autoCompleteMatch = chalk.blue(
120120
`${autoCompletePart.substring(0, relativeCurserPos)}${chalk.bgWhite(
121121
autoCompletePart.substring(relativeCurserPos, relativeCurserPos + 1)
122122
)}${autoCompletePart.substring(relativeCurserPos + 1)}`

src/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ AwesomeLogger.log('awd5');
297297

298298
const defaultText = AwesomeLogger.prompt('text', {
299299
text: 'Please enter your phone number:',
300-
default: '+49 ',
300+
hints: ['+49...', '+43...', '+41...'],
301301
});
302302

303303
await defaultText.result.then(r => {

0 commit comments

Comments
 (0)