@@ -44,24 +44,24 @@ export class FindInput extends Widget {
4444 private contextViewProvider : IContextViewProvider ;
4545 private width : number ;
4646 private placeholder : string ;
47- private validation : IInputValidator ;
47+ private validation ? : IInputValidator ;
4848 private label : string ;
4949 private fixFocusOnOptionClickEnabled = true ;
5050
51- private inputActiveOptionBorder : Color ;
52- private inputBackground : Color ;
53- private inputForeground : Color ;
54- private inputBorder : Color ;
55-
56- private inputValidationInfoBorder : Color ;
57- private inputValidationInfoBackground : Color ;
58- private inputValidationInfoForeground : Color ;
59- private inputValidationWarningBorder : Color ;
60- private inputValidationWarningBackground : Color ;
61- private inputValidationWarningForeground : Color ;
62- private inputValidationErrorBorder : Color ;
63- private inputValidationErrorBackground : Color ;
64- private inputValidationErrorForeground : Color ;
51+ private inputActiveOptionBorder ? : Color ;
52+ private inputBackground ? : Color ;
53+ private inputForeground ? : Color ;
54+ private inputBorder ? : Color ;
55+
56+ private inputValidationInfoBorder ? : Color ;
57+ private inputValidationInfoBackground ? : Color ;
58+ private inputValidationInfoForeground ? : Color ;
59+ private inputValidationWarningBorder ? : Color ;
60+ private inputValidationWarningBackground ? : Color ;
61+ private inputValidationWarningForeground ? : Color ;
62+ private inputValidationErrorBorder ? : Color ;
63+ private inputValidationErrorBackground ? : Color ;
64+ private inputValidationErrorForeground ? : Color ;
6565
6666 private regex : RegexCheckbox ;
6767 private wholeWords : WholeWordsCheckbox ;
@@ -90,7 +90,7 @@ export class FindInput extends Widget {
9090 private _onRegexKeyDown = this . _register ( new Emitter < IKeyboardEvent > ( ) ) ;
9191 public readonly onRegexKeyDown : Event < IKeyboardEvent > = this . _onRegexKeyDown . event ;
9292
93- constructor ( parent : HTMLElement , contextViewProvider : IContextViewProvider , private readonly _showOptionButtons : boolean , options ? : IFindInputOptions ) {
93+ constructor ( parent : HTMLElement , contextViewProvider : IContextViewProvider , private readonly _showOptionButtons : boolean , options : IFindInputOptions ) {
9494 super ( ) ;
9595 this . contextViewProvider = contextViewProvider ;
9696 this . width = options . width || 100 ;
@@ -113,13 +113,7 @@ export class FindInput extends Widget {
113113 this . inputValidationErrorBackground = options . inputValidationErrorBackground ;
114114 this . inputValidationErrorForeground = options . inputValidationErrorForeground ;
115115
116- this . regex = null ;
117- this . wholeWords = null ;
118- this . caseSensitive = null ;
119- this . domNode = null ;
120- this . inputBox = null ;
121-
122- this . buildDomNode ( options . appendCaseSensitiveLabel || '' , options . appendWholeWordsLabel || '' , options . appendRegexLabel || '' , options . history , options . flexibleHeight ) ;
116+ this . buildDomNode ( options . appendCaseSensitiveLabel || '' , options . appendWholeWordsLabel || '' , options . appendRegexLabel || '' , options . history || [ ] , ! ! options . flexibleHeight ) ;
123117
124118 if ( Boolean ( parent ) ) {
125119 parent . appendChild ( this . domNode ) ;
@@ -298,7 +292,7 @@ export class FindInput extends Widget {
298292 placeholder : this . placeholder || '' ,
299293 ariaLabel : this . label || '' ,
300294 validationOptions : {
301- validation : this . validation || null
295+ validation : this . validation
302296 } ,
303297 inputBackground : this . inputBackground ,
304298 inputForeground : this . inputForeground ,
@@ -370,7 +364,7 @@ export class FindInput extends Widget {
370364 if ( event . equals ( KeyCode . LeftArrow ) || event . equals ( KeyCode . RightArrow ) || event . equals ( KeyCode . Escape ) ) {
371365 let index = indexes . indexOf ( < HTMLElement > document . activeElement ) ;
372366 if ( index >= 0 ) {
373- let newIndex : number ;
367+ let newIndex : number = - 1 ;
374368 if ( event . equals ( KeyCode . RightArrow ) ) {
375369 newIndex = ( index + 1 ) % indexes . length ;
376370 } else if ( event . equals ( KeyCode . LeftArrow ) ) {
@@ -405,19 +399,27 @@ export class FindInput extends Widget {
405399 }
406400
407401 public validate ( ) : void {
408- this . inputBox . validate ( ) ;
402+ if ( this . inputBox ) {
403+ this . inputBox . validate ( ) ;
404+ }
409405 }
410406
411407 public showMessage ( message : InputBoxMessage ) : void {
412- this . inputBox . showMessage ( message ) ;
408+ if ( this . inputBox ) {
409+ this . inputBox . showMessage ( message ) ;
410+ }
413411 }
414412
415413 public clearMessage ( ) : void {
416- this . inputBox . hideMessage ( ) ;
414+ if ( this . inputBox ) {
415+ this . inputBox . hideMessage ( ) ;
416+ }
417417 }
418418
419419 private clearValidation ( ) : void {
420- this . inputBox . hideMessage ( ) ;
420+ if ( this . inputBox ) {
421+ this . inputBox . hideMessage ( ) ;
422+ }
421423 }
422424
423425 public dispose ( ) : void {
0 commit comments