Skip to content

REPL: Show input alias (e.g., \\:cat:) for Char display #58181

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

Merged
merged 5 commits into from
May 21, 2025
Merged
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,17 @@ display(d::REPLDisplay, x) = display(d, MIME("text/plain"), x)

show_repl(io::IO, mime::MIME"text/plain", x) = show(io, mime, x)

# new method for AbstractChar
function show_repl(io::IO, mime::MIME"text/plain", c::AbstractChar)
show(io, mime, c) # Call the original Base.show
# Check for LaTeX/emoji alias and print if found and using symbol_latex which is used in help?> mode
latex = symbol_latex(string(c))
if !isempty(latex)
print(io, ", input as ")
printstyled(io, latex, color=:cyan)
end
end

show_repl(io::IO, ::MIME"text/plain", ex::Expr) =
print(io, JuliaSyntaxHighlighting.highlight(
sprint(show, ex, context=IOContext(io, :color => false))))
Expand Down
Loading