Skip to content

Commit

Permalink
[REPL] 0nly do NFD normalization for latex tab-completion help if no …
Browse files Browse the repository at this point in the history
…match without it (#41870)
  • Loading branch information
GunnarFarneback committed Aug 16, 2021
1 parent 398d1a0 commit ab600f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions stdlib/REPL/src/docview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,13 @@ function symbol_latex(s::String)
return get(symbols_latex, s, "")
end
function repl_latex(io::IO, s::String)
# decompose NFC-normalized identifier to match tab-completion input
s = normalize(s, :NFD)
latex = symbol_latex(s)
if isempty(latex)
# Decompose NFC-normalized identifier to match tab-completion
# input if the first search came up empty.
s = normalize(s, :NFD)
latex = symbol_latex(s)
end
if !isempty(latex)
print(io, "\"")
printstyled(io, s, color=:cyan)
Expand Down
2 changes: 2 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,8 @@ end

# issue #36378 (\u1e8b and x\u307 are the fully composed and decomposed forms of ẋ, respectively)
@test sprint(repl_latex, "\u1e8b") == "\"x\u307\" can be typed by x\\dot<tab>\n\n"
# issue 39814
@test sprint(repl_latex, "\u2209") == "\"\u2209\" can be typed by \\notin<tab>\n\n"

# issue #15684
begin
Expand Down

0 comments on commit ab600f8

Please sign in to comment.