craigfe / progress

Progress bar library for OCaml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Line breaks when under-padding

gbelouze opened this issue · comments

Using padding functions Line.lpad and Line.rpad with a padding smaller than the segment messes up the line width computation : the code

open Progress
let () = 
    let reporter = Line.(list [const "Foo" |> rpad 2 ; bar 1_000]) in
    Progress.with_reporter reporter @@ fun reporter ->
        for _ = 1 to 100 do reporter 1 ; Unix.sleepf  0.01 done

produces the output

Foo [-------------------------------------------------------------------------
Foo [#------------------------------------------------------------------------
Foo [##-----------------------------------------------------------------------
Foo [###----------------------------------------------------------------------
Foo [####---------------------------------------------------------------------
Foo [#####--------------------------------------------------------------------
]

It could be desired for the semantics of padding to be "pad if smaller, ignore otherwise" instead ?