From 8089dc40215b496643d90847157d8ad0772622bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8egh?= Date: Tue, 11 Nov 2014 22:05:59 +0100 Subject: [PATCH] Make Latex completion in strings --- base/REPLCompletions.jl | 5 ++++- test/replcompletions.jl | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/base/REPLCompletions.jl b/base/REPLCompletions.jl index 82114eaa3b8b0..bf92d2ad1de48 100644 --- a/base/REPLCompletions.jl +++ b/base/REPLCompletions.jl @@ -196,11 +196,14 @@ function completions(string, pos) (length(string) <= pos || string[pos+1] != '"') # or there's already a " at the cursor. paths[1] *= "\"" end - return sort(paths), r, success + #Latex symbols can be completed for strings + (success || inc_tag==:cmd) && return sort(paths), r, success end ok, ret = latex_completions(string, pos) ok && return ret + # Make sure that only latex_completions is working on strings + inc_tag==:string && return UTF8String[], 0:-1, false if inc_tag == :other && string[pos] == '(' endpos = prevind(string, pos) diff --git a/test/replcompletions.jl b/test/replcompletions.jl index c4917f778f01c..53d64481127b6 100644 --- a/test/replcompletions.jl +++ b/test/replcompletions.jl @@ -73,6 +73,13 @@ c,r = test_latexcomplete(s) @test r == 1:length(s) @test length(c) == 1 +# test latex symbol completions in strings +s = "\"C:\\\\ \\alpha" +c,r,res = test_complete(s) +@test c[1] == "α" +@test r == 7:12 +@test length(c) == 1 + ## Test completion of packages #mkp(p) = ((@assert !isdir(p)); mkdir(p)) #temp_pkg_dir() do