Skip to content

Readline::HISTORY.delete_at(index) not working for indices of negative values #161

@pingport80

Description

@pingport80

Summary

Readline::HISTORY.delete_at method not working for indices of negative values.

Steps to Reproduce

irb
require 'readline'
Readline::HISTORY.push('a')
=> ["a"]
Readline::HISTORY.push('b')
=> ["b"]
Readline::HISTORY.push('c')
=> ["c"]
>> Readline::HISTORY.delete_at(-1)
/var/lib/gems/2.7.0/gems/rb-readline-0.5.5/lib/readline.rb:458:in `delete_at': undefined method `+' for nil:NilClass (NoMethodError)

Additional Information

    def self.delete_at(index)
      if index < 0
        i += RbReadline.history_length

i variable is not defined here, which I think is causing the problem. I guess it was meant to be index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions