Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #10324 #10336

Merged
merged 2 commits into from
Mar 2, 2015
Merged

fix #10324 #10336

merged 2 commits into from
Mar 2, 2015

Conversation

dhoegh
Copy link
Contributor

@dhoegh dhoegh commented Feb 26, 2015

This fixes #10324.

@dhoegh
Copy link
Contributor Author

dhoegh commented Feb 26, 2015

The Appveyor failure is unrelated.

@JeffBezanson
Copy link
Sponsor Member

Awesome, thanks!

@@ -130,8 +130,12 @@ function complete_path(path::AbstractString, pos)
push!(matches, id ? file * (@windows? "\\\\" : "/") : file)
end
end
matches = UTF8String[replace(s, r"\s", "\\ ") for s in matches]
return matches, nextind(path, pos - sizeof(prefix) - length(matchall(r" ", prefix))):pos, length(matches) > 0
matches = UTF8String[replace(s, r" ", "\\ ") for s in matches]
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we don't need the \s to escape all spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this line's change is actually not for fixing the bug. The reason for this is to replace space in path with "\ " so it is correctly escaped for paths and files. I have incidentally introduced "\s" instead of " " in pull #8838. It do not seem to do any difference since file names cannot contain tabs, return carriage and new line. However I think it is more correct to only match " "

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It do not seem to do any difference since file names cannot contain tabs, return carriage and new line.

posix filenames can contain any character except / (i haven't looked at the rest of this PR to see how that fits in)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. The only case the code take into account since it replaces "\s" with "\\ " but it should then be replaced like: replace(s, r"(\s)", "\\1")? I will revert this line change and then correct it in another pull because there are multiple other places that then needs to be changed.

@dhoegh
Copy link
Contributor Author

dhoegh commented Mar 2, 2015

Bump this can be merged, unless I should revert 2b81792 as I discuss in #10357 (comment). I think I should revert because it is not correct to replace all occurrences of a whitespace char in a filename like with an escaped space like replace(s, r"\s", "\\ ").

ivarne added a commit that referenced this pull request Mar 2, 2015
@ivarne ivarne merged commit 54004c6 into JuliaLang:master Mar 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REPL Tab Completion on Unicode Filenames
4 participants