Implement Clone for Buffer and use Arc::make_mut
This commit is contained in:
parent
0a11fb1045
commit
46d60a3723
4 changed files with 21 additions and 10 deletions
|
|
@ -237,6 +237,21 @@ pub struct Buffer {
|
|||
scratch: ShapeBuffer,
|
||||
}
|
||||
|
||||
impl Clone for Buffer {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
lines: self.lines.clone(),
|
||||
metrics: self.metrics,
|
||||
width: self.width,
|
||||
height: self.height,
|
||||
scroll: self.scroll,
|
||||
redraw: self.redraw,
|
||||
wrap: self.wrap,
|
||||
scratch: ShapeBuffer::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Buffer {
|
||||
/// Create an empty [`Buffer`] with the provided [`Metrics`].
|
||||
/// This is useful for initializing a [`Buffer`] without a [`FontSystem`].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue