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

Only do NFD normalization for latex tab-completion if needed #41870

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this second lookup is not needed?

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