Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FixedEffects"
uuid = "c8885935-8500-56a7-9867-7708b20db0eb"
version = "3.5.1"
version = "3.5.2"

[deps]
GroupedArrays = "6407cd72-fade-4a84-8a1e-56e431fc1533"
Expand Down
29 changes: 18 additions & 11 deletions src/utils/progressbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,29 @@ function showprogress(io::IO, p::MiniProgressBar)
p.has_shown = true
n_filled = ceil(Int, p.width * perc / 100)
n_left = p.width - n_filled
print(io, " "^p.indent)
printstyled(io, p.header, color=p.color, bold=true)
print(io, " [")
print(io, "="^n_filled, ">")
print(io, " "^n_left, "] ", )
# Render into a buffer, then write it with invokelatest, which is not
# inferred through: printing to stdout, which is only known to be an IO,
# compiles calls that packages adding IO methods (e.g. FilePathsBase)
# invalidate, along with solve_residuals! and its callers
buf = IOContext(IOBuffer(), :color => get(io, :color, false))
print(buf, " "^p.indent)
printstyled(buf, p.header, color=p.color, bold=true)
print(buf, " [")
print(buf, "="^n_filled, ">")
print(buf, " "^n_left, "] ", )
if p.percentage
@printf io "%2.1f %%" perc
@printf buf "%2.1f %%" perc
else
print(io, p.current, "/", p.max)
print(buf, p.current, "/", p.max)
end
print(io, "\r")
print(buf, "\r")
Base.invokelatest(write, io, take!(buf.io))
return nothing
end

function end_progress(io, p::MiniProgressBar)
function end_progress(io::IO, p::MiniProgressBar)
ansi_enablecursor = "\e[?25h"
ansi_clearline = "\e[2K"
print(io, ansi_enablecursor)
print(io, ansi_clearline)
Base.invokelatest(print, io, ansi_enablecursor * ansi_clearline)
return nothing
end
Loading