Skip to content

Commit

Permalink
add hat only to the first character
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov committed Nov 14, 2024
1 parent 3005796 commit 955a95f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/QSymbolicsBase/literal_objects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ Base.show(io::IO, x::SKet) = print(io, "|$(symbollabel(x))⟩")
Base.show(io::IO, x::SBra) = print(io, "$(symbollabel(x))|")
Base.show(io::IO, x::Union{SOperator,SHermitianOperator,SUnitaryOperator,SHermitianUnitaryOperator}) = begin
symbol_name = String(symbollabel(x))
middle_index = (length(symbol_name) + 1) ÷ 2
print(io, symbol_name[1:middle_index-1] * symbol_name[middle_index] * "\u0302" * symbol_name[middle_index+1:end]) # add hat to the middle character
print(io, symbol_name[1:1] * "\u0302" * symbol_name[2:end]) # add hat to the first character
end
Base.show(io::IO, x::SymQObj) = print(io, symbollabel(x)) # fallback that probably is not great

Expand Down

0 comments on commit 955a95f

Please sign in to comment.