diff options
-rw-r--r-- | lib/irb/completion.rb | 2 | ||||
-rw-r--r-- | test/irb/test_completion.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 84f4c4e35a..64e387d49c 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -233,7 +233,7 @@ module IRB if doc_namespace candidates.find { |i| i == receiver } else - candidates.grep(/^#{receiver}/).collect{|e| "::" + e} + candidates.grep(/^#{Regexp.quote(receiver)}/).collect{|e| "::" + e} end when /^([A-Z].*)::([^:.]*)$/ diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb index e259428d76..6a24f0f9ba 100644 --- a/test/irb/test_completion.rb +++ b/test/irb/test_completion.rb @@ -310,6 +310,7 @@ module TestIRB assert_empty(IRB::InputCompletor.retrieve_completion_data("::A.", bind: binding)) assert_empty(IRB::InputCompletor.retrieve_completion_data("::A(", bind: binding)) assert_empty(IRB::InputCompletor.retrieve_completion_data("::A)", bind: binding)) + assert_empty(IRB::InputCompletor.retrieve_completion_data("::A[", bind: binding)) end def test_complete_reserved_words |