File tree 1 file changed +10
-9
lines changed
@commitlint/prompt/src/library
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -64,10 +64,9 @@ export default function getPrompt(
64
64
} ,
65
65
tabCompletion : enumRule
66
66
? enumRule [ 1 ] [ 2 ] . map ( ( enumerable ) => {
67
- const value = forceLeadingBlankFn ( forceCaseFn ( enumerable ) ) ;
68
67
const enumSettings = ( settings . enumerables || { } ) [ enumerable ] || { } ;
69
68
return {
70
- value : value ,
69
+ value : forceLeadingBlankFn ( forceCaseFn ( enumerable ) ) ,
71
70
description : enumSettings . description || '' ,
72
71
} ;
73
72
} )
@@ -92,13 +91,15 @@ export default function getPrompt(
92
91
return prefix + EOL ;
93
92
} ,
94
93
maxLength ( res : Result ) {
95
- const headerLength = settings . header ? settings . header . length : Infinity ;
96
- const header = `${ res . type } ${ res . scope ? `(${ res . scope } )` : '' } ${
97
- res . type || res . scope ? ': ' : ''
98
- } ${ res . subject } `;
99
- const remainingHeaderLength = headerLength
100
- ? headerLength - header . length
101
- : Infinity ;
94
+ let remainingHeaderLength = Infinity ;
95
+ if ( settings . header && settings . header . length ) {
96
+ const header = format ( {
97
+ type : res . type ,
98
+ scope : res . scope ,
99
+ subject : res . subject ,
100
+ } ) ;
101
+ remainingHeaderLength = settings . header . length - header . length ;
102
+ }
102
103
return Math . min ( inputMaxLength , remainingHeaderLength ) ;
103
104
} ,
104
105
transformer ( value : string ) {
You can’t perform that action at this time.
0 commit comments