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
2 parents 499236f + 9928655 commit a3aa526
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 a3aa526

Please sign in to comment.