Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make Base.ANSIIterator have a concrete field #56088

Merged
merged 1 commit into from
Oct 11, 2024
Merged
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
8 changes: 4 additions & 4 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ ncodeunits(c::ANSIDelimiter) = ncodeunits(c.del)
textwidth(::ANSIDelimiter) = 0

# An iterator similar to `pairs(::String)` but whose values are Char or ANSIDelimiter
struct ANSIIterator
captures::RegexMatchIterator
struct ANSIIterator{S}
captures::RegexMatchIterator{S}
end
ANSIIterator(s::AbstractString) = ANSIIterator(eachmatch(ansi_regex, s))

IteratorSize(::Type{ANSIIterator}) = SizeUnknown()
eltype(::Type{ANSIIterator}) = Pair{Int, Union{Char,ANSIDelimiter}}
IteratorSize(::Type{<:ANSIIterator}) = SizeUnknown()
eltype(::Type{<:ANSIIterator}) = Pair{Int, Union{Char,ANSIDelimiter}}
function iterate(I::ANSIIterator, (i, m_st)=(1, iterate(I.captures)))
m_st === nothing && return nothing
m, (j, new_m_st) = m_st
Expand Down