From 564308b7e990080c7fb86d80b7567b331347ba12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8egh?= Date: Mon, 24 Nov 2014 17:42:44 +0100 Subject: [PATCH] Fix so latex completion do not interfere with path completion in strings. --- base/REPLCompletions.jl | 2 +- test/replcompletions.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/base/REPLCompletions.jl b/base/REPLCompletions.jl index 490bb41178adf..e5b7e4465433f 100644 --- a/base/REPLCompletions.jl +++ b/base/REPLCompletions.jl @@ -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, "") diff --git a/test/replcompletions.jl b/test/replcompletions.jl index e70c5828f2e49..bb6780fb91b0c 100644 --- a/test/replcompletions.jl +++ b/test/replcompletions.jl @@ -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)