@@ -100,7 +100,11 @@ var Finder = Module("finder", {
100
100
this . _backwards = mode == modes . SEARCH_BACKWARD ;
101
101
//commandline.open(this._backwards ? "Find backwards" : "Find", "", mode);
102
102
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
+ }
104
108
} ) ;
105
109
//modes.extended = mode;
106
110
@@ -124,15 +128,27 @@ var Finder = Module("finder", {
124
128
125
129
// PDF.JS files are different, they use their own messages to communicate the results.
126
130
// 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 ;
128
132
findbar . updateControlState = function ( aResult , aFindPrevious ) {
129
- this . _original_updateControlState ( aResult , aFindPrevious ) ;
133
+ this . _vimpbackup_updateControlState ( aResult , aFindPrevious ) ;
130
134
finder . onFindResult ( {
131
135
searchString : this . _findField . value ,
132
136
result : aResult ,
133
137
findBackwards : aFindPrevious
134
138
} ) ;
135
139
} ;
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
+ } ;
136
152
}
137
153
138
154
findbar . _find ( ) ;
@@ -160,7 +176,12 @@ var Finder = Module("finder", {
160
176
*/
161
177
onFindResult : function ( aData ) {
162
178
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 ) ;
164
185
}
165
186
else if ( aData . result == Ci . nsITypeAheadFind . FIND_WRAPPED ) {
166
187
let msg = aData . findBackwards ? "Search hit TOP, continuing at BOTTOM" : "Search hit BOTTOM, continuing at TOP" ;
0 commit comments