diff --git a/base/subarray.jl b/base/subarray.jl index 61d59bddf547d..fa142a8843c63 100644 --- a/base/subarray.jl +++ b/base/subarray.jl @@ -483,8 +483,8 @@ end has_offset_axes(S::SubArray) = has_offset_axes(S.indices...) function replace_in_print_matrix(S::SubArray{<:Any,2,<:AbstractMatrix}, i::Integer, j::Integer, s::AbstractString) - replace_in_print_matrix(S.parent, reindex(S.indices, (i,j))..., s) + replace_in_print_matrix(S.parent, to_indices(S.parent, reindex(S.indices, (i,j)))..., s) end function replace_in_print_matrix(S::SubArray{<:Any,1,<:AbstractVector}, i::Integer, j::Integer, s::AbstractString) - replace_in_print_matrix(S.parent, reindex(S.indices, (i,))..., j, s) + replace_in_print_matrix(S.parent, to_indices(S.parent, reindex(S.indices, (i,)))..., j, s) end diff --git a/test/subarray.jl b/test/subarray.jl index f7350d50f793d..da2a88d68408e 100644 --- a/test/subarray.jl +++ b/test/subarray.jl @@ -799,6 +799,9 @@ end end V = view(OneElVec(6, 2), 1:5) @test sprint(show, "text/plain", V) == "$(summary(V)):\n ⋅\n 1\n ⋅\n ⋅\n ⋅" + + V = view(1:2, [CartesianIndex(2)]) + @test sprint(show, "text/plain", V) == "$(summary(V)):\n 2" end @testset "Base.first_index for offset indices" begin