Skip to content

Commit 60dec58

Browse files
committed
REPL: new backslash escape hack for Windows Pkg completions
1 parent 69db0a5 commit 60dec58

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ function complete_path(path::AbstractString;
421421
cmd_escape=false,
422422
string_escape=false,
423423
contract_user=false)
424+
# println("\ncomplete path: $path")
425+
# println("shell: $shell_escape, cmd: $cmd_escape, string: $string_escape")
424426
@assert !(shell_escape && string_escape)
425427
if Base.Sys.isunix() && occursin(r"^~(?:/|$)", path)
426428
# if the path is just "~", don't consider the expanded username as a prefix
@@ -492,10 +494,8 @@ function complete_path(path::AbstractString,
492494
end
493495
startpos = pos - lastindex(prefix) + 1
494496
Sys.iswindows() && map!(paths, paths) do c::PathCompletion
495-
# emulation for unnecessarily complicated return value, since / is a
496-
# perfectly acceptable path character which does not require quoting
497-
# but is required by Pkg's awkward parser handling
498-
return endswith(c.path, "/") ? PathCompletion(chop(c.path) * "\\\\") : c
497+
# HACK: Pkg requires escaped backslashes
498+
return PathCompletion(replace(c.path, "\\" => "\\\\"))
499499
end
500500
return paths, startpos:pos, success
501501
end

0 commit comments

Comments
 (0)