mooz/keysnail

Can't exit from CaretMode by pushing "C-g"

Closed this issue · 1 comments

In CaretMode, push "C-g". But, the mode still remains in CaretMode.

The first generated configuration is the following by KeySnail.

hook.addToHook('KeyBoardQuit', function (aEvent) {
    if (key.currentKeySequence.length) {
        return;
    }
    command.closeFindBar();
    var marked = command.marked(aEvent);
    if (util.isCaretEnabled()) {
        if (marked) {
            command.resetMark(aEvent);
        } else {
            if ("blur" in aEvent.target) {
                aEvent.target.blur();
            }
            gBrowser.focus();
            _content.focus();
        }
    } else {
        goDoCommand("cmd_selectNone");
    }
    if (KeySnail.windowType === "navigator:browser" && !marked) {
        key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
    }
});

I changed it to the following. Then, I can exit from CaretMode by pushing "C-g".

hook.addToHook('KeyBoardQuit', function (aEvent) {
    if (key.currentKeySequence.length) {
        return;
    }
    command.closeFindBar();
    var marked = command.marked(aEvent);
    if (util.isCaretEnabled()) {
        if (marked) {
            command.resetMark(aEvent);
        } else {
            if ("blur" in aEvent.target) {
                aEvent.target.blur();
            }
            util.setBoolPref("accessibility.browsewithcaret", false);
            gBrowser.focus();
            _content.focus();
        }
    } else {
        goDoCommand("cmd_selectNone");
    }
    if (KeySnail.windowType === "navigator:browser" && !marked) {
        key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
    }
});

I added util.setBoolPref("accessibility.browsewithcaret", false);.

  • This change is correct?

My environment is the following.

  • WindowsXP SP3
  • Firefox 18.0
  • KeySnail 2.0.1
mooz commented

Setting false to accessibility.browsewithcaret is a standard way to exit from caret mode. So, your change is correct.