code: function _bindKeypress(state) {
      state.onKeypress = function(ch, key) {
          if (!key || !state.onFirstLine) {
              // Ignore the up/down history searcing when we've extended to a new line
              return;
          }
  
          var replace = null;
          if (_keyIs(key, 'up')) {
              replace = state.history.prev();
          } else if (_keyIs(key, 'down')) {
              replace = state.history.next();
          }
  
          if (_.isString(replace)) {
              // This will close the current prompt, so we can safely get a new one by re-invoking
              // `_read`
              _resetReadLine(state);
              state.currentLine = replace;
              return _read(state);
          }
      };
  
      state.input.on('keypress', state.onKeypress);
  }
docs: /*!
  Bind the keypress handling to the input stream to handle navigating command history