Skip to content

Commit

Permalink
Fix path completion when UTF8 char is occurring before match characters.
Browse files Browse the repository at this point in the history
(cherry picked from commit 9b3a83b)
ref: #9227
  • Loading branch information
dhoegh authored and ivarne committed Dec 6, 2014
1 parent 9aa4517 commit 967b37a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function completions(string, pos)
inc_tag = Base.incomplete_tag(parse(partial , raise=false))
if inc_tag in [:cmd, :string]
m = match(r"[\t\n\r\"'`@\$><=;|&\{]| (?!\\)", reverse(partial))
startpos = length(partial) - (m == nothing ? 1 : m.offset) + 2
startpos = nextind(partial, endof(partial)) - m.offset + 1
r = startpos:pos
paths, r, success = complete_path(replace(string[r], r"\\ ", " "), pos)
if inc_tag == :string &&
Expand Down
4 changes: 2 additions & 2 deletions test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ end

let #test that it can auto complete with spaces in file/path
path = tempdir()
space_folder = randstring() * " r"
space_folder = randstring() * " α"
dir = joinpath(path, space_folder)
dir_space = replace(space_folder, " ", "\\ ")
mkdir(dir)
Expand All @@ -183,7 +183,7 @@ let #test that it can auto complete with spaces in file/path
@test r == endof(s)-4:endof(s)
@test "space\\ .file" in c

s = @windows? "cd(\"$dir_space\\\\space" : "cd(\"$dir_space/space"
s = @windows? "cd(\"β $dir_space\\\\space" : "cd(\"β $dir_space/space"
c,r = test_complete(s)
@test r == endof(s)-4:endof(s)
@test "space\\ .file\"" in c
Expand Down

0 comments on commit 967b37a

Please sign in to comment.