diff --git a/stdlib/REPL/src/REPLCompletions.jl b/stdlib/REPL/src/REPLCompletions.jl index 149920381dcc8..e09e3b2aa9e6b 100644 --- a/stdlib/REPL/src/REPLCompletions.jl +++ b/stdlib/REPL/src/REPLCompletions.jl @@ -1021,7 +1021,7 @@ function completions(string::String, pos::Int, context_module::Module=Main, shif ok, ret = bslash_completions(string, pos) ok && return ret startpos = first(varrange) + 4 - dotpos = something(findprev(isequal('.'), string, startpos), 0) + dotpos = something(findprev(isequal('.'), string, first(varrange)-1), 0) return complete_identifiers!(Completion[], ffunc, context_module, string, string[startpos:pos], pos, dotpos, startpos) # otherwise... diff --git a/stdlib/REPL/test/replcompletions.jl b/stdlib/REPL/test/replcompletions.jl index 4577be19fa9ac..036cda53aa2a2 100644 --- a/stdlib/REPL/test/replcompletions.jl +++ b/stdlib/REPL/test/replcompletions.jl @@ -1819,7 +1819,7 @@ let s = "var\"complicated " @test c == Any["var\"complicated symbol with spaces\""] end -let s = "WeirdNames().var\"oh " +for s in ("WeirdNames().var\"oh ", "WeirdNames().var\"") c, r = test_complete_foo(s) @test c == Any["var\"oh no!\"", "var\"oh yes!\""] end