class Reline::History

def push(*val)

def push(*val)
  # If history_size is zero, all histories are dropped.
  return self if @config.history_size.zero?
  # If history_size is negative, history size is unlimited.
  if @config.history_size.positive?
    diff = size + val.size - @config.history_size
    if diff > 0
      if diff <= size
        shift(diff)
      else
        diff -= size
        clear
        val.shift(diff)
      end
    end
  end
  super(*(val.map{ |v|
    String.new(v, encoding: Reline.encoding_system_needs)
  }))
end