diff --git a/stdlib/REPL/src/REPLCompletions.jl b/stdlib/REPL/src/REPLCompletions.jl index 20d26953eb22b6..57797583de75f6 100644 --- a/stdlib/REPL/src/REPLCompletions.jl +++ b/stdlib/REPL/src/REPLCompletions.jl @@ -943,7 +943,7 @@ function complete_identifiers!(suggestions::Vector{Completion}, @nospecialize(ff ex = nothing comp_keywords && append!(suggestions, complete_keyword(name)) if dotpos > 1 && string[dotpos] == '.' - s = string[1:dotpos-1] + s = string[1:prevind(string, dotpos)] # First see if the whole string up to `pos` is a valid expression. If so, use it. ex = Meta.parse(s, raise=false, depwarn=false) if isexpr(ex, :incomplete) diff --git a/stdlib/REPL/test/replcompletions.jl b/stdlib/REPL/test/replcompletions.jl index b2199e10bef55d..4c777a78cf5939 100644 --- a/stdlib/REPL/test/replcompletions.jl +++ b/stdlib/REPL/test/replcompletions.jl @@ -23,6 +23,8 @@ let ex = quote end type_test = Test_x(Test_y(1)) (::Test_y)() = "", "" + unicode_αβγ = Test_y(1) + module CompletionFoo2 end @@ -253,6 +255,11 @@ let s = "Main.CompletionFoo.type_test.x" @test s[r] == "x" end +let s = "Main.CompletionFoo.unicode_αβγ.y" + c, r = test_complete(s) + @test "yy" in c +end + let s = "Main.CompletionFoo.bar.no_val_available" c, r = test_complete(s) @test length(c)==0