Skip to content

Commit

Permalink
move printing of [:, :, 1, 2] = to label_nd_slices (JuliaLang#38341)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Abbott <me@escbook>
  • Loading branch information
mcabbott and Michael Abbott authored Nov 23, 2020
1 parent af4c97c commit 809f27c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ function show_nd(io::IO, a::AbstractArray, print_matrix::Function, label_slices:
@goto skip
end
end
#println(io, idxs)
print(io, "...\n\n")
@goto skip
end
Expand All @@ -297,9 +296,7 @@ function show_nd(io::IO, a::AbstractArray, print_matrix::Function, label_slices:
end
end
if label_slices
print(io, "[:, :, ")
for i = 1:(nd-1); print(io, "$(idxs[i]), "); end
println(io, idxs[end], "] =")
_show_nd_label(io, a, idxs)
end
slice = view(a, axes(a,1), axes(a,2), idxs...)
print_matrix(io, slice)
Expand All @@ -308,6 +305,14 @@ function show_nd(io::IO, a::AbstractArray, print_matrix::Function, label_slices:
end
end

function _show_nd_label(io::IO, a::AbstractArray, idxs)
print(io, "[:, :, ")
for i = 1:length(idxs)-1
print(io, idxs[i], ", ")
end
println(io, idxs[end], "] =")
end

# print_array: main helper functions for show(io, text/plain, array)
# typeinfo agnostic
# Note that this is for showing the content inside the array, and for `MIME"text/plain".
Expand Down

0 comments on commit 809f27c

Please sign in to comment.