function fixRepeatedCtrlFCommand(editor) {
  // ModifiedSearch creates and shows a SearchBox with a modified
  // when-open-keybinding.
  // * Repeated Ctrl-F while the search box is open will just findNext,
  //   and it will select the search input so that it can be retyped.
  //   If in replace mode, Ctrl-F will just skip to the next match
  //   without replacing it.
  // * Ctrl-H (or Command-Option-F) while the search box is open will
  //   switch a non-replace searchbox into replace mode.  If replace-mode
  //   is already open, it focuses on the replace box (if not yet focused),
  //   or if the replace box already has focus, it executes a replacement.
  // As you can see, it takes committment (Ctrl-H) to execute a replacement
  // by keyboard, so it is less likely to happen by accident.
  function ModifiedSearch(searchbox, isReplace) {
    var sb = editor.searchBox || new searchbox.SearchBox(editor);
    sb.$searchBarKb.bindKeys({
      "Ctrl-F|Command-F": function(sb) {
        sb.findNext();
        if (sb.activeInput == sb.searchInput) {
          sb.searchInput.select();
        }
      },
      "Ctrl-H|Command-Option-F": function(sb) {
        if (!sb.isReplace) {
          sb.isReplace = true;
          sb.replaceBox.style.display = "";
          sb.replaceInput.focus();
        } else if (sb.activeInput == sb.replaceInput) {
          sb.replace();
          sb.findNext();
        } else {
          sb.replaceInput.focus();
        }
      }
    });
    sb.show(editor.session.getTextRange(), isReplace);
  }
  // The when not-open keybindings for Ctrl-F and Ctrl-H create our
  // modified SearchBox instead of the ACE editor default SearchBox.
  editor.commands.addCommands([{
    name: "find",
    bindKey: { win: "Ctrl-F", mac: "Command-F" },
    exec: function(editor, line) {
      ace.require('./config').loadModule(
        "ace/ext/searchbox",
        function(module) { ModifiedSearch(module, false); }
      );
    },
    readOnly: true
  }, {
    name: "replace",
    bindKey: { win: "Ctrl-H", mac: "Command-Option-F" },
    exec: function(editor, line) {
      ace.require('./config').loadModule(
        "ace/ext/searchbox",
        function(module) { ModifiedSearch(module, true); }
      );
    },
    readOnly: true
  }])
}
// the safe and logical thing: it does repeated searches.
the safe and logical thing: it does repeated searches.
the safe and logical thing : it does repeated searches .
function fixRepeatedCtrlFCommand(editor) {
  function ModifiedSearch(searchbox, isReplace) {
    var sb = editor.searchBox || new searchbox.SearchBox(editor);
    sb.$searchBarKb.bindKeys({
      "Ctrl-F|Command-F": function(sb) {
        sb.findNext();
        if (sb.activeInput == sb.searchInput) {
          sb.searchInput.select();
        }
      },
      "Ctrl-H|Command-Option-F": function(sb) {
        if (!sb.isReplace) {
          sb.isReplace = true;
          sb.replaceBox.style.display = "";
          sb.replaceInput.focus();
        } else if (sb.activeInput == sb.replaceInput) {
          sb.replace();
          sb.findNext();
        } else {
          sb.replaceInput.focus();
        }
      }
    });
    sb.show(editor.session.getTextRange(), isReplace);
  }
  editor.commands.addCommands([{
    name: "find",
    bindKey: { win: "Ctrl-F", mac: "Command-F" },
    exec: function(editor, line) {
      ace.require('./config').loadModule(
        "ace/ext/searchbox",
        function(module) { ModifiedSearch(module, false); }
      );
    },
    readOnly: true
  }, {
    name: "replace",
    bindKey: { win: "Ctrl-H", mac: "Command-Option-F" },
    exec: function(editor, line) {
      ace.require('./config').loadModule(
        "ace/ext/searchbox",
        function(module) { ModifiedSearch(module, true); }
      );
    },
    readOnly: true
  }])
}
function fixRepeatedCtrlFCommand ( editor ) { function ModifiedSearch ( searchbox , isReplace ) { var sb = editor . searchBox || new searchbox . SearchBox ( editor ) ; sb . $searchBarKb . bindKeys ( { "Ctrl-F|Command-F" : function ( sb ) { sb . findNext ( ) ; if ( sb . activeInput == sb . searchInput ) { sb . searchInput . select ( ) ; } } , "Ctrl-H|Command-Option-F" : function ( sb ) { if ( ! sb . isReplace ) { sb . isReplace = true ; sb . replaceBox . style . display = "" ; sb . replaceInput . focus ( ) ; } else if ( sb . activeInput == sb . replaceInput ) { sb . replace ( ) ; sb . findNext ( ) ; } else { sb . replaceInput . focus ( ) ; } } } ) ; sb . show ( editor . session . getTextRange ( ) , isReplace ) ; } editor . commands . addCommands ( [ { name : "find" , bindKey : { win : "Ctrl-F" , mac : "Command-F" } , exec : function ( editor , line ) { ace . require ( './config' ) . loadModule ( "ace/ext/searchbox" , function ( module ) { ModifiedSearch ( module , false ) ; } ) ; } , readOnly : true } , { name : "replace" , bindKey : { win : "Ctrl-H" , mac : "Command-Option-F" } , exec : function ( editor , line ) { ace . require ( './config' ) . loadModule ( "ace/ext/searchbox" , function ( module ) { ModifiedSearch ( module , true ) ; } ) ; } , readOnly : true } ] ) }
the safe and logical thing: it does repeated searches.
the safe and logical thing : it does repeated searches .
// ModifiedSearch creates and shows a SearchBox with a modified // when-open-keybinding. // * Repeated Ctrl-F while the search box is open will just findNext, //   and it will select the search input so that it can be retyped. //   If in replace mode, Ctrl-F will just skip to the next match //   without replacing it. // * Ctrl-H (or Command-Option-F) while the search box is open will //   switch a non-replace searchbox into replace mode.  If replace-mode //   is already open, it focuses on the replace box (if not yet focused), //   or if the replace box already has focus, it executes a replacement. // As you can see, it takes committment (Ctrl-H) to execute a replacement // by keyboard, so it is less likely to happen by accident. // The when not-open keybindings for Ctrl-F and Ctrl-H create our // modified SearchBox instead of the ACE editor default SearchBox.