Skip to content

Commit 5e29e3e

Browse files
committed
Ignore invalid 3 colons in completion
1 parent 4781f67 commit 5e29e3e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/irb/completion.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace
286286
all_gvars.grep(Regexp.new(Regexp.quote(gvar)))
287287
end
288288

289-
when /^([^."].*)(\.|::)([^.]*)$/
289+
when /^([^.:"].*)(\.|::)([^.]*)$/
290290
# variable.func or func.func
291291
receiver = $1
292292
sep = $2

test/irb/test_completion.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def test_complete_symbol
3232
assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
3333
end
3434

35+
def test_complete_invalid_three_colons
36+
assert_empty(IRB::InputCompletor.retrieve_completion_data(":::A", bind: binding))
37+
assert_empty(IRB::InputCompletor.retrieve_completion_data(":::", bind: binding))
38+
end
39+
3540
def test_complete_symbol_failure
3641
assert_nil(IRB::InputCompletor::PerfectMatchedProc.(":aiueo", bind: binding))
3742
end

0 commit comments

Comments
 (0)