Wrong calculation of header lines if the display is smaller than the header
ronisbr opened this issue · comments
julia> a = rand(100, 3);
julia> pretty_table(a, header = ([1,2,3],[1,2,3]), display_size = (1, -1))
ERROR: BoundsError: attempt to access 1-element Vector{Int64} at index [1:2]
Stacktrace:
[1] throw_boundserror(A::Vector{Int64}, I::Tuple{UnitRange{Int64}})
@ Base ./abstractarray.jl:703
[2] checkbounds
@ ./abstractarray.jl:668 [inlined]
[3] view
@ ./subarray.jl:177 [inlined]
[4] maybeview
@ ./views.jl:146 [inlined]
[5] _count_header_lines
@ ~/.julia/dev/PrettyTables/src/backends/text/misc.jl:298 [inlined]
[6] _compute_continuation_row_in_bottom_vcrop
@ ~/.julia/dev/PrettyTables/src/backends/text/misc.jl:59 [inlined]
[7] _pt_text(io::IOContext{Base.TTY}, pinfo::PrettyTables.PrintInfo; alignment_anchor_fallback::Symbol, alignment_anchor_fallback_override::Dict{Int64, Symbol}, alignment_anchor_regex::Dict{Int64, Vector{Regex}}, autowrap::Bool, body_hlines::Vector{Int64}, body_hlines_format::Nothing, continuation_row_alignment::Symbol, crop::Symbol, crop_subheader::Bool, columns_width::Int64, display_size::Tuple{Int64, Int64}, equal_columns_width::Bool, ellipsis_line_skip::Int64, highlighters::Tuple{}, hlines::Nothing, linebreaks::Bool, maximum_columns_width::Int64, minimum_columns_width::Int64, newline_at_end::Bool, overwrite::Bool, reserved_display_lines::Int64, show_omitted_cell_summary::Bool, sortkeys::Bool, tf::TextFormat, title_autowrap::Bool, title_same_width_as_table::Bool, vcrop_mode::Symbol, vlines::Nothing, border_crayon::Crayon, header_crayon::Crayon, omitted_cell_summary_crayon::Crayon, row_label_crayon::Crayon, row_label_header_crayon::Crayon, row_number_header_crayon::Crayon, subheader_crayon::Crayon, text_crayon::Crayon, title_crayon::Crayon)
@ PrettyTables ~/.julia/dev/PrettyTables/src/backends/text/print.jl:341
[8] _pt(io::IO, data::Matrix{Float64}; alignment::Symbol, backend::Val{:auto}, cell_alignment::Nothing, cell_first_line_only::Bool, compact_printing::Bool, formatters::Nothing, header::Tuple{Vector{Int64}, Vector{Int64}}, header_alignment::Symbol, header_cell_alignment::Nothing, limit_printing::Bool, max_num_of_columns::Int64, max_num_of_rows::Int64, renderer::Symbol, row_labels::Nothing, row_label_alignment::Symbol, row_label_column_title::String, row_number_alignment::Symbol, row_number_column_title::String, show_header::Bool, show_row_number::Bool, show_subheader::Bool, title::String, title_alignment::Symbol, kwargs::Base.Pairs{Symbol, Tuple{Int64, Int64}, Tuple{Symbol}, NamedTuple{(:display_size,), Tuple{Tuple{Int64, Int64}}}})
@ PrettyTables ~/.julia/dev/PrettyTables/src/private.jl:386
[9] #_pretty_table#68
@ ~/.julia/dev/PrettyTables/src/private.jl:275 [inlined]
[10] #pretty_table#60
@ ~/.julia/dev/PrettyTables/src/print.jl:702 [inlined]
[11] top-level scope
@ REPL[44]:1