Skip to content

Commit

Permalink
Merge pull request #9137 from dhoegh/latex_completion_string_fix
Browse files Browse the repository at this point in the history
Fix so latex completion do not interfere with path completion in strings on windows.
  • Loading branch information
tkelman committed Nov 25, 2014
2 parents b780b80 + 564308b commit 3d10054
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ end

function latex_completions(string, pos)
slashpos = rsearch(string, '\\', pos)
if rsearch(string, whitespace_chars, pos) < slashpos
if rsearch(string, whitespace_chars, pos) < slashpos && !(1 < slashpos && (string[slashpos-1]=='\\'))
# latex symbol substitution
s = string[slashpos:pos]
latex = get(latex_symbols, s, "")
Expand Down
6 changes: 6 additions & 0 deletions test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ c,r = test_latexcomplete(s)
@test r == 1:length(s)
@test length(c) == 1

# test latex symbol completions in strings should not work when there
# is a backslash in front of `\alpha` because it interferes with path completion on windows
s = "cd(\"path_to_an_empty_folder_should_not_complete_latex\\\\\\alpha"
c,r,res = test_complete(s)
@test length(c) == 0

# test latex symbol completions in strings
s = "\"C:\\\\ \\alpha"
c,r,res = test_complete(s)
Expand Down

0 comments on commit 3d10054

Please sign in to comment.