FindBar-Tweak icon indicating copy to clipboard operation
FindBar-Tweak copied to clipboard

Delayed highlights not working?

Open harl opened this issue 11 years ago • 5 comments

The option to delay highlights if a search term is shorter than x characters doesn't seem to have any effect for me. I've set it to 3 but whenever I enter even just 1 character in the find bar, it immediately highlights every occurrence of it. On larger pages, this sometimes causes quite a delay of up to several seconds but not in the way it is intended, more like lag or unresponsiveness. I'd prefer if any highlighting wouldn't happen at all before I have entered at least 3 characters.

harl avatar Apr 12 '14 11:04 harl

The delay should only be a second and a half (1500ms), but it will still highlight whatever you input if you don't type anything after that time has passed. Can you confirm this is not happening? (i.e, input 4 characters and see if the delay is exactly the same as when you input only 2).

Also, the feature of not highlighting at all when less than x characters is something I already plan to add in the future.

Quicksaver avatar Apr 12 '14 11:04 Quicksaver

Only just now I finally got around to understand your response and the meaning of that option which I really misinterpreted before. Sorry for that (as well as my late response, heh..). It's all my fault.

Searching and Highlighting work very well, including the intended delay you mentioned. What I thought was that there was supposed to be a limit until which (I assumed) the highlighting itself shouldn't happen, meaning with only 1 or 2 characters in the find bar, I didn't expect there to be any highlighting at all, not just a short delay.

The additional "delay" I experience is the one that happens when I input 1 or 2 characters in the find bar and wait for those 1500ms, the browser highlights all occurrences of something like "a" or "th" which can be a lot on certain larger pages and consequently stalls the browser for an additional 1-5 seconds while it processes/renders (assuming it's the highlights and not just the basic search) - even though this laptop is fairly fast and my Firefox/Waterfox now runs off a hybrid ramdisk (except Cache).

So, this is probably more like a feature request than an issue report now - as you had practically mentioned the same thing already. Would it be feasible to make the delay customisable? Might be easier than to differentiate the on/off state of highlighting. Either way would work for me.

harl avatar Sep 02 '14 11:09 harl

Making the delay customizable is a good idea! It might take a while though, as I haven't had any free time to work on the add-on lately unfortunately.

Quicksaver avatar Sep 02 '14 11:09 Quicksaver

Hi. I had the same misunderstanding as the OP. I thought that FBT wouldn't auto highlight anything until the number of characters typed exceeded the number set in preferences.

That would be a useful feature. It could prevent a lot of unintentional searches when a single character is accidentally typed, or when the focus is in the wrong place, which can be really frustrating.

IMeanReallyNow avatar Nov 10 '14 21:11 IMeanReallyNow

Yea. Often an input field would lose focus for some reason, like on websites that continue to load additional stuff (images, frames, comments) in the background, which would consequently have me unintentionally typeahead instead, often just one or two letters because I stop typing when I see the page scrolling. I hate it when that happens, especially when scrolling or losing focus causes the input fields or a popup frame to collapse/reload and get cleared, and I understand it's generally not FBT to blame for that, but rather the website or even the browser's rendering engine. I like typeahead too much over having to press Ctrl+F, so disabling it isn't an option. (To disable typeahead, open about:config and toggle accessibility.typeaheadfind to false.)

In the meantime, one can manually edit the corresponding file and hard change the variable. Navigate to the /extensions/ directory, extract "[email protected]" (to a separate directory!) which is basically just a zip archive file, and edit the file /resource/modules/highlights.jsm, or skip the manual extraction part if you know how, Notepad works for editing either way (just mind to keep the semicolons intact), then just increase the value for LONG_DELAY from 1500 to whatever works better for you, depending on how often you would actually search for just 1-2 letters (if your threshold is set to 3). I know I rarely ever search for less than 4, so I just set my LONG_DELAY to 3600000 (equals 1 hour). Then save the file, let 7-zip (or whatever) update the xpi (or re-zip & rename manually), and restart FF. Not sure about memory leaks or allocation issues in js related to long timers, but I haven't noticed an adverse effect yet. Double-Escaping the find bar should always cancel the bar and the highlighting anyway.

harl avatar Nov 11 '14 07:11 harl