mooz / keysnail

Allows you to bind commands to key sequences in Mozilla Firefox
http://wiki.github.com/mooz/keysnail
701 stars 56 forks source link

how to walkInputElement Textareas (like [ and ] in w3m)? #60

Open unhammer opened 13 years ago

unhammer commented 13 years ago

I would like to do this:

key.setViewKey("]", function () {
    command.walkInputElement(command.elementsRetrieverTextarea, true, true);
}, "Focus to the next textarea", false);

key.setViewKey("[", function () {
    command.walkInputElement(command.elementsRetrieverTextarea, false, true);
}, "Focus to the previous textarea", false);

(based on M-n/M-p, I want it to work like in w3m), but they seem to have no effect. What am I doing wrong?

unhammer commented 12 years ago

The best I have until now is:

   key.setViewKey([["M-]"], ["M-["]], function (aEvent, aArg) {
       command.focusElement(command.elementsRetrieverTextarea, 0);
   }, "Focus to the first textarea", true);
   key.setCaretKey([["M-]"], ["M-["]], function (aEvent, aArg) {
       command.focusElement(command.elementsRetrieverTextarea, 0);
   }, "Focus to the first textarea", true);

   key.setEditKey("M-]", function (aEvent, aArg) {
       ext.exec("focus-to-the-next-text-area", aArg);
   }, "Focus to the next textarea", true);
   key.setEditKey("M-[", function (aEvent, aArg) {
       ext.exec("focus-to-the-previous-text-area", aArg);
   }, "Focus to the previous textarea", true);

which puts focus in the first textarea and then goes through them. Unfortunately, it doesn't seem to cycle (I can't go from first straight back to last).

A better workaround seems to be to just use HoK.