Skip to content
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
2 changes: 1 addition & 1 deletion base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ centered cdot, used in printing of structural zeros of structured matrices.
Accept keyword args `c` for alternate single character marker.
"""
function replace_with_centered_mark(s::AbstractString;c::AbstractChar = '⋅')
N = length(s)
N = textwidth(ANSIIterator(s))
return join(setindex!([" " for i=1:N],string(c),ceil(Int,N/2)))
end

Expand Down
4 changes: 4 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2379,6 +2379,10 @@ Base.show(io::IO, ces::⛵) = Base.print(io, '⛵')
@test Base.alignment(IOContext(IOBuffer(), :color=>true), ColoredLetter()) == (0, 1)
@test Base.alignment(IOContext(IOBuffer(), :color=>false), ColoredLetter()) == (0, 1)

# spacing around dots in Diagonal, etc:
redminusthree = sprint((io, x) -> printstyled(io, x, color=:red), "-3", context=stdout)
@test Base.replace_with_centered_mark(redminusthree) == Base.replace_with_centered_mark("-3")

# `show` implementations for `Method`
let buf = IOBuffer()

Expand Down