class Byebug::History

def to_s(size = Setting[:histsize])

def to_s(size = Setting[:histsize])
  rl_size = Readline::HISTORY.length
  n_entries = rl_size < size ? rl_size : size
  first = rl_size - n_entries
  commands = Readline::HISTORY.to_a.last(n_entries)
  s = ''
  commands.each_with_index do |command, index|
    s += format("%5d  %s\n", first + index + 1, command)
  end
  s
end