Inserts the previous command from history into the line.
431257
def insertPreviousCommand(self):
        
        self._currentHistoryIndex -= 1
        if 0 <= self._currentHistoryIndex < len(self._history):
            cmd = self._history[self._currentHistoryIndex]
        else:
            cmd = '>>> '
            self._currentHistoryIndex = len(self._history)
        
        self.replaceCommand(cmd)
1332756
def move_prev(lines=1, file=sys.stdout):
    
    move.prev(lines).write(file=file)
591584
function insert (history, state, limit, group) {
  debug.log('inserting', state)
  debug.log('new free: ', limit - lengthWithoutFuture(history))

  const { past, _latestUnfiltered } = history
  const historyOverflow = limit && lengthWithoutFuture(history) >= limit

  const pastSliced = past.slice(historyOverflow ? 1 : 0)
  const newPast = _latestUnfiltered != null
    ? [
      ...pastSliced,
      _latestUnfiltered
    ] : pastSliced

  return newHistory(newPast, state, [], group)
}
161018
def _update_history(self):
        """"""
        version = self.data['new_version']
        history = self.vcs.history_file()
        if not history:
            logger.warn("No history file found")
            return
        history_lines = open(history).read().split('\n')
        headings = utils.extract_headings_from_history(history_lines)
        if not len(headings):
            logger.warn("No detectable existing version headings in the "
                        "history file.")
            inject_location = 0
            underline_char = '-'
        else:
            first = headings[0]
            inject_location = first['line']
            underline_line = first['line'] + 1
            try:
                underline_char = history_lines[underline_line][0]
            except IndexError:
                logger.debug("No character on line below header.")
                underline_char = '-'
        header = '%s (unreleased)' % version
        inject = [header,
                  underline_char * len(header),
                  '',
                  self.data['nothing_changed_yet'],
                  '',
                  '']
        history_lines[inject_location:inject_location] = inject
        contents = '\n'.join(history_lines)
        open(history, 'w').write(contents)
        logger.info("Injected new section into the history: %r", header)
304612
def _handle_prompt_command(self, buffer):
        "  "
        text = buffer.text
        prompt_command = self.prompt_command

        # Leave command mode and handle command.
        self.pymux.leave_command_mode(append_to_history=True)
        self.pymux.handle_command(prompt_command.replace('%%', text))
603346
def add_history(self, fname, fargs, init=0):
        
        if init == 1:
            self.history = []
        self.history.append([fname, fargs])
237015
def insertLine(self, i) :
		""""""
		self.data.insert(i, CSVEntry(self))
		return self.lines[i]
338980
def clear_history(pymux, variables):
    "  "
    pane = pymux.arrangement.get_active_pane()

    if pane.display_scroll_buffer:
        raise CommandException('Not available in copy mode')
    else:
        pane.process.screen.clear_history()
913151
def _do_history(self, cmd, args):
        
        if args and args[0] == 'clear':
            readline.clear_history()
            readline.write_history_file(self.history_fname)
        elif args and args[0] == 'clearall':
            readline.clear_history()
            shutil.rmtree(self._temp_dir, ignore_errors = True)
            os.makedirs(os.path.join(self._temp_dir, 'history'))
        else:
            readline.write_history_file(self.history_fname)
            with open(self.history_fname, 'r', encoding = 'utf8') as f:
                self.stdout.write(f.read())
34676
function history(repl, file) {

  try {
    var stat = fs.statSync(file);
    repl.rli.history = fs.readFileSync(file, 'utf-8').split('\n').reverse();
    repl.rli.history.shift();
    repl.rli.historyIndex = -1;
  } catch (e) {}

  var fd = fs.openSync(file, 'a'),
    reval = repl.eval;

  repl.rli.addListener('line', function(code) {
    if (code && code !== '.history') {
      fs.write(fd, code + '\n');
    } else {
      repl.rli.historyIndex++;
      repl.rli.history.pop();
    }
  });

  process.on('exit', function() {
    fs.closeSync(fd);
  });

  repl.commands['.history'] = {
    help: 'Show the history',
    action: function() {
      var out = [];
      repl.rli.history.forEach(function(v, k) {
        out.push(v);
      });
      repl.outputStream.write(out.reverse().join('\n') + '\n');
      repl.displayPrompt();
    }
  };
}
1267684
def write_history_file(self, filename = None): 
        '''
        if filename is None:
            filename = self.history_filename
        fp = open(filename, u'wb')
        for line in self.history[-self.history_length:]:
            fp.write(ensure_str(line.get_line_text()))
            fp.write(u'\n')
        fp.close()
695279
def history(verbose, range):
    
    alembic_command.history(
        config=get_config(),
        rev_range=range,
        verbose=verbose
    )
375100
function _loop(options, onCommand, _history) {
    _history = _history || [];

    var readOptions = _.extend({}, options, {
        'ps1': options.ps1(),
        'ps2': options.ps2(),
        'history': _history
    });

    read(readOptions, function(err, args, str) {
        // If the user entered an actual command, put the string in the command history
        if (str) {
            _history.push(str.split('\n').shift());
        }

        // Provide the args to the caller
        onCommand(err, args, str, function() {
            // Recursively ask for the next command
            return _loop(options, onCommand, _history);
        });
    });
}
482375
function(text)
    {
        if (this._uncommittedIsTop) {
            this._data.pop();
            delete this._uncommittedIsTop;
        }

        this._historyOffset = 1;
        if (this._coalesceHistoryDupes && text === this._currentHistoryItem())
            return;
        this._data.push(text);
    }
1082757
def _write_history(self, pfx, hdu, linechar=60, indentchar=2):
        
        channel = self.fv.get_channel(self.chname)
        if channel is None:
            return

        history_plgname = 'ChangeHistory'
        try:
            history_obj = self.fv.gpmon.getPlugin(history_plgname)
        except Exception:
            self.logger.error(
                '{0} plugin is not loaded. No HISTORY will be written to '
                '{1}.'.format(history_plgname, pfx))
            return

        if channel.name not in history_obj.name_dict:
            self.logger.error(
                '{0} channel not found in {1}. No HISTORY will be written to '
                '{2}.'.format(channel.name, history_plgname, pfx))
            return

        file_dict = history_obj.name_dict[channel.name]
        chistory = []
        ind = ' ' * indentchar

        # NOTE: List comprehension too slow!
        for key in file_dict:
            if not key.startswith(pfx):
                continue
            for bnch in file_dict[key].values():
                chistory.append('{0} {1}'.format(bnch.MODIFIED, bnch.DESCRIP))

        # Add each HISTORY prettily into header, sorted by timestamp
        for s in sorted(chistory):
            for i in range(0, len(s), linechar):
                subs = s[i:i + linechar]
                if i > 0:
                    subs = ind + subs.lstrip()
                hdu.header.add_history(subs)
1331428
def run_command(self, cmd, history=True, new_prompt=True):
        """"""
        if not cmd:
            cmd = ''
        else:
            if history:
                self.add_to_history(cmd)
        if not self.multithreaded:
            if 'input' not in cmd:
                self.interpreter.stdin_write.write(
                                                to_binary_string(cmd + '\n'))
                self.interpreter.run_line()
                self.refresh.emit()
            else:
                self.write(_('In order to use commands like "raw_input" '
                             'or "input" run Spyder with the multithread '
                             'option (--multithread) from a system terminal'),
                           error=True)
        else:
            self.interpreter.stdin_write.write(to_binary_string(cmd + '\n'))
1065825
public void addHistory(Object historyKey)
    {
        if (this.history == null)
        {
            this.history = new KeyHistory();
        }

        this.history.addKey(historyKey.toString());
    }