I was playing with some ideas and CoPilot suggested that I call the non-existent Buffer::fill(area, ".", style) method
This seems like it's probably a useful simple building block method to have that avoids putting that loop in the caller.
I'd see this used internally for block borders, barchart, chart, scrollbars, etc. and any custom widgets that need to fill an area.
Solution
Add a fill method that accepts an area, a symbol, and a style.
A naive approach runs a loop over the area and writes the symbols appropriately (taking account of unicode width).
It might be possible to special case single width characters by using slice::fill
Problem
I was playing with some ideas and CoPilot suggested that I call the non-existent
Buffer::fill(area, ".", style)
method This seems like it's probably a useful simple building block method to have that avoids putting that loop in the caller. I'd see this used internally for block borders, barchart, chart, scrollbars, etc. and any custom widgets that need to fill an area.Solution
Add a fill method that accepts an area, a symbol, and a style. A naive approach runs a loop over the area and writes the symbols appropriately (taking account of unicode width). It might be possible to special case single width characters by using slice::fill
It might also be worth considering whether this allocates new cells and fills the buffer vs calling the set_symbol / set_style methods (in the same way that https://github.com/ratatui-org/ratatui/pull/1143#pullrequestreview-2079128188 needs to take this into account).
Additional context
This is an idea for discussion rather than something ready to implement.