Skip to content

Commit 01bf160

Browse files
knueselsimeonschaub
authored andcommitted
Use NFD-normalized identifiers to match LaTeX hints (JuliaLang#36382)
* Add test for x\dot help (JuliaLang#36378) (The test currently fails.) * Decompose identifiers in REPL LaTeX matching This fixes the help for e.g. x\dot. Closes JuliaLang#36378
1 parent 3fc09ba commit 01bf160

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

stdlib/REPL/src/docview.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ using Base: with_output_color
1313

1414
using InteractiveUtils: subtypes
1515

16+
using Unicode: normalize
17+
1618
## Help mode ##
1719

1820
# This is split into helpmode and _helpmode to easier unittest _helpmode
@@ -328,6 +330,8 @@ function symbol_latex(s::String)
328330
return get(symbols_latex, s, "")
329331
end
330332
function repl_latex(io::IO, s::String)
333+
# decompose NFC-normalized identifier to match tab-completion input
334+
s = normalize(s, :NFD)
331335
latex = symbol_latex(s)
332336
if !isempty(latex)
333337
print(io, "\"")

test/docs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,9 @@ end
985985
@test sprint(repl_latex, "") == "\"\" can be typed by \\sqrt<tab>\n\n"
986986
@test sprint(repl_latex, "x̂₂") == "\"x̂₂\" can be typed by x\\hat<tab>\\_2<tab>\n\n"
987987

988+
# issue #36378 (\u1e8b and x\u307 are the fully composed and decomposed forms of ẋ, respectively)
989+
@test sprint(repl_latex, "\u1e8b") == "\"x\u307\" can be typed by x\\dot<tab>\n\n"
990+
988991
# issue #15684
989992
begin
990993
"""

0 commit comments

Comments
 (0)