Git Product home page Git Product logo

Comments (6)

afarah1 avatar afarah1 commented on August 16, 2024 5

Okay, I was able to pinpoint the issue. It's an infinite loop in common/modules/finder.jsm:491. That is, in the highlight function of the RangeFind class. Link. When removing that loop the issue disappears entirely (though highlighting results also breaks).

I got to this by placing a breakpoint before and after the loop (after trying other spots at finder.jsm). It reaches the first breakpoint, I press play, but it never reaches the second - Firefox becomes irresponsible and I have to kill it.

I am testing it on a more recent version of Firefox than I previously reported:

:version
Pentadactyl 1.2pre (created 2017/05/31 22:07:30) running on:
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Can any devs take a look at this?

from dactyl.

troyp avatar troyp commented on August 16, 2024 1

One simple way to work around this is to hide the input elements while the highlighting is done and restore them. I tested it (manually) and it works. (Obviously, the matches in the input fields are left out.)

If you restore the fields immediately after the highlighting, you do lose the wraparound behaviour of n/N however: to get back to the top match from the bottom, you have to reverse direction or repeat the search. If you leave the fields hidden, n/N wil work normally.

Note: once the fields are unhidden and the highlighting is cancelled, pressing n/N will freeze the browser, since it repeats the search highlighting with the input fields visible. (If you wanted, you could prevent this issue by never actually cancelling the search highlighting, but instead hiding it temporarily using a style.)

If you want to test it, you can use these commands from my .pentadactylrc:

command! hideselector  -nargs=* -js hideSelectors.call(null, ...args);
command! unhideselector  -nargs=* -js unhideSelectors.call(null, ...args);

js <<EOF
function hideSelectors(...sels) {
    var doc = content.document;
    sels.forEach(sel=>{
        var elts = Array.from(doc.querySelectorAll(sel));
        elts.forEach(e=>{
            var css = e.getAttribute('style') || '';
            e.setAttribute('style', css+" display: none !important;");
        });
    });
}
function unhideSelectors(...sels) {
    var doc = content.document;
    sels.forEach(sel=>{
        var elts = Array.from(doc.querySelectorAll(sel));
        elts.forEach(e=>{
            var css = e.getAttribute('style') || '';
            var hideregex = /(^|;| ) *display: *none *(!important)? *;/g;
            e.setAttribute('style', css.replace(hideregex, ''));
        });
    });
}
EOF

I tried rebinding /, n and N to hide the input fields first, and using C-/ to clear the highlighting and unhide the input fields.

map <hide-inputs> -ex hideselector input
map <unhide-inputs> -ex unhideselector input
map / <hide-inputs><find-forward>
map n <hide-inputs><find-next>
map N <hide-inputs><find-previous>
map <C-/> -ex noh | unhideselector input

but it seemed a bit unreliable, so I've settled on just rebinding / and leaving the input fields hidden. If I need them again after searching, I have a binding specifically to restore them:

map <hide-inputs> -ex hideselector input
map <unhide-inputs> -ex unhideselector input
map / <hide-inputs><find-forward>
map <C-?> <unhide-inputs>

This can be implemented in a .pentadactylrc file. A better workaround would be to hack the source so the highlight function simply ignores matches in input fields. I haven't tried that yet, but it sounds simple enough.

from dactyl.

Massimo-B avatar Massimo-B commented on August 16, 2024

Any news here, if this can be fixed?

from dactyl.

Massimo-B avatar Massimo-B commented on August 16, 2024

As this issue is annoying I'm going to test your workaround. However I would appreciate a bugfix in the sources.

from dactyl.

Massimo-B avatar Massimo-B commented on August 16, 2024

This seems to work sometimes, but now always.
For instance: Search an IP address if some edit field is open.

How to reproduce:

..freezing.

from dactyl.

Massimo-B avatar Massimo-B commented on August 16, 2024

This is still unstable, last freeze on https://forums.gentoo.org, writing a comment, preview, search by /, freeze. Which is most annoying as all the comment is lost...

from dactyl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.