@@ -128,15 +128,27 @@ var Finder = Module("finder", {
128
128
129
129
// PDF.JS files are different, they use their own messages to communicate the results.
130
130
// So we piggyback the end changes to the findbar when there are any.
131
- findbar . _original_updateControlState = findbar . updateControlState ;
131
+ findbar . _vimpbackup_updateControlState = findbar . updateControlState ;
132
132
findbar . updateControlState = function ( aResult , aFindPrevious ) {
133
- this . _original_updateControlState ( aResult , aFindPrevious ) ;
133
+ this . _vimpbackup_updateControlState ( aResult , aFindPrevious ) ;
134
134
finder . onFindResult ( {
135
135
searchString : this . _findField . value ,
136
136
result : aResult ,
137
137
findBackwards : aFindPrevious
138
138
} ) ;
139
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
+ } ;
140
152
}
141
153
142
154
findbar . _find ( ) ;
@@ -278,6 +290,18 @@ var Finder = Module("finder", {
278
290
function ( ) { finder . clear ( ) ; } ,
279
291
{ argCount : "0" } ) ;
280
292
} ,
293
+ events : function ( ) {
294
+ if ( config . name == 'Vimperator' ) {
295
+ // Same thing as the note above for not showing the findbar on failed results
296
+ // through the command line, but for compatibility with FindBar Tweak.
297
+ events . addSessionListener ( window , "WillOpenFindBar" , function ( event ) {
298
+ if ( commandline . _keepOpenForInput ) {
299
+ event . preventDefault ( ) ;
300
+ event . stopPropagation ( ) ;
301
+ }
302
+ } , true ) ;
303
+ }
304
+ } ,
281
305
mappings : function ( ) {
282
306
var myModes = config . browserModes ;
283
307
myModes = myModes . concat ( [ modes . CARET ] ) ;
0 commit comments