Skip to content

Commit 190e87c

Browse files
committed
Fix IteratorAndFirst
1 parent 41c9563 commit 190e87c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/TableView.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ to_css_size(s::Real) = "$(s)px"
2222
struct IteratorAndFirst{F, T}
2323
first::F
2424
source::T
25-
IteratorAndFirst(x) = new(iterate(x), x)
25+
function IteratorAndFirst(x)
26+
first = iterate(x)
27+
return new{typeof(first), typeof(x)}(first, x)
28+
end
2629
end
2730
Base.IteratorSize(::Type{IteratorAndFirst{F, T}}) where {F, T} = Base.IteratorSize(T)
2831
Base.length(x::IteratorAndFirst) = length(x.source)
@@ -31,7 +34,7 @@ Base.eltype(x::IteratorAndFirst) = eltype(x.source)
3134
Base.iterate(x::IteratorAndFirst) = x.first
3235
function Base.iterate(x::IteratorAndFirst, st)
3336
st === nothing && return nothing
34-
return iterate(x.source)
37+
return iterate(x.source, st)
3538
end
3639

3740
function showtable(table; dark = false, height = :auto, width = "100%")

0 commit comments

Comments
 (0)