@@ -100,7 +100,11 @@ var Finder = Module("finder", {
100100 this . _backwards = mode == modes . SEARCH_BACKWARD ;
101101 //commandline.open(this._backwards ? "Find backwards" : "Find", "", mode);
102102 commandline . input ( this . _backwards ? "Find backwards" : "Find" , this . closure . onSubmit , {
103- onChange : function ( ) { if ( options [ "incsearch" ] ) finder . find ( commandline . command ) }
103+ onChange : function ( ) {
104+ if ( options [ "incsearch" ] && ! commandline . _isIMEComposing ) {
105+ finder . find ( commandline . command ) ;
106+ }
107+ }
104108 } ) ;
105109 //modes.extended = mode;
106110
@@ -124,15 +128,27 @@ var Finder = Module("finder", {
124128
125129 // PDF.JS files are different, they use their own messages to communicate the results.
126130 // So we piggyback the end changes to the findbar when there are any.
127- findbar . _original_updateControlState = findbar . updateControlState ;
131+ findbar . _vimpbackup_updateControlState = findbar . updateControlState ;
128132 findbar . updateControlState = function ( aResult , aFindPrevious ) {
129- this . _original_updateControlState ( aResult , aFindPrevious ) ;
133+ this . _vimpbackup_updateControlState ( aResult , aFindPrevious ) ;
130134 finder . onFindResult ( {
131135 searchString : this . _findField . value ,
132136 result : aResult ,
133137 findBackwards : aFindPrevious
134138 } ) ;
135139 } ;
140+
141+ // Normally the findbar appears to notify on failed results.
142+ // However, this shouldn't happen when we're finding through the command line,
143+ // even though that way we lose any kind of no matches notification until we
144+ // stop typing altogether; something to work on at a later time:
145+ // - show the quick findbar which will hide after a few seconds?
146+ // - or notify the user somehow in the command line itself?
147+ findbar . _vimpbackup_open = findbar . open ;
148+ findbar . open = function ( aMode ) {
149+ if ( commandline . _keepOpenForInput ) { return false ; }
150+ return this . _vimpbackup_open ( aMode ) ;
151+ } ;
136152 }
137153
138154 findbar . _find ( ) ;
@@ -160,7 +176,12 @@ var Finder = Module("finder", {
160176 */
161177 onFindResult : function ( aData ) {
162178 if ( aData . result == Ci . nsITypeAheadFind . FIND_NOTFOUND ) {
163- liberator . echoerr ( "Pattern not found: " + aData . searchString , commandline . FORCE_SINGLELINE ) ;
179+ // Don't use aData.searchString, it may be a substring of the
180+ // user's actual input text and that can be confusing.
181+ // See https://github.com/vimperator/vimperator-labs/issues/401#issuecomment-180522987
182+ // for an example.
183+ let searchString = this . findbar . _findField . value ;
184+ liberator . echoerr ( "Pattern not found: " + searchString , commandline . FORCE_SINGLELINE ) ;
164185 }
165186 else if ( aData . result == Ci . nsITypeAheadFind . FIND_WRAPPED ) {
166187 let msg = aData . findBackwards ? "Search hit TOP, continuing at BOTTOM" : "Search hit BOTTOM, continuing at TOP" ;
0 commit comments