B2G/gecko/browser/devtools/debugger/debugger-view.js
/**
   * The keypress listener for the scripts search box.
   */
The keypress listener for the scripts search box.
The keypress listener for the scripts search box .
function DVS__onScriptsKeyPress(e) {
    if (e.keyCode === e.DOM_VK_ESCAPE) {
      DebuggerView.editor.focus();
      return;
    }
    var action;
    if (e.keyCode === e.DOM_VK_DOWN ||
        e.keyCode === e.DOM_VK_RETURN ||
        e.keyCode === e.DOM_VK_ENTER) {
      action = 1;
    } else if (e.keyCode === e.DOM_VK_UP) {
      action = 2;
    }
    if (action) {
      let [file, line, token, isGlobal] = this.searchboxInfo;
      if (token.length) {
        e.preventDefault();
        e.stopPropagation();
      } else {
        return;
      }
      if (isGlobal) {
        if (DebuggerView.GlobalSearch.hidden) {
          DebuggerView.GlobalSearch.scheduleSearch();
        } else {
          DebuggerView.GlobalSearch[action === 1
            ? "focusNextMatch"
            : "focusPrevMatch"]();
        }
        return;
      }
      let editor = DebuggerView.editor;
      let offset = editor[action === 1 ? "findNext" : "findPrevious"](true);
      if (offset > -1) {
        editor.setSelection(offset, offset + token.length)
      }
    }
  }
function DVS__onScriptsKeyPress ( e ) { if ( e . keyCode === e . DOM_VK_ESCAPE ) { DebuggerView . editor . focus ( ) ; return ; } var action ; if ( e . keyCode === e . DOM_VK_DOWN || e . keyCode === e . DOM_VK_RETURN || e . keyCode === e . DOM_VK_ENTER ) { action = 1 ; } else if ( e . keyCode === e . DOM_VK_UP ) { action = 2 ; } if ( action ) { let [ file , line , token , isGlobal ] = this . searchboxInfo ; if ( token . length ) { e . preventDefault ( ) ; e . stopPropagation ( ) ; } else { return ; } if ( isGlobal ) { if ( DebuggerView . GlobalSearch . hidden ) { DebuggerView . GlobalSearch . scheduleSearch ( ) ; } else { DebuggerView . GlobalSearch [ action === 1 ? "focusNextMatch" : "focusPrevMatch" ] ( ) ; } return ; } let editor = DebuggerView . editor ; let offset = editor [ action === 1 ? "findNext" : "findPrevious" ] ( true ) ; if ( offset > - 1 ) { editor . setSelection ( offset , offset + token . length ) } } }
The keypress listener for the scripts search box.
The keypress listener for the scripts search box .