diff options
Diffstat (limited to 'lib/reline/history.rb')
-rw-r--r-- | lib/reline/history.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/reline/history.rb b/lib/reline/history.rb index d95f1cebc3..2e6a12ecf3 100644 --- a/lib/reline/history.rb +++ b/lib/reline/history.rb @@ -29,6 +29,8 @@ class Reline::History < Array end def push(*val) + # If history_size is zero, all histories are dropped. + return self if @config.history_size.zero? diff = size + val.size - @config.history_size if diff > 0 if diff <= size @@ -43,6 +45,8 @@ class Reline::History < Array end def <<(val) + # If history_size is zero, all histories are dropped. + return self if @config.history_size.zero? shift if size + 1 > @config.history_size super(String.new(val, encoding: Reline.encoding_system_needs)) end |