diff --git a/src/buffer_line.rs b/src/buffer_line.rs index 3ff511a..fb808f0 100644 --- a/src/buffer_line.rs +++ b/src/buffer_line.rs @@ -38,13 +38,11 @@ impl BufferLine { /// /// Will reset shape and layout if it differs from current text and attributes list. /// Returns true if the line was reset - pub fn set_text + Into>( - &mut self, - text: T, - attrs_list: AttrsList, - ) -> bool { - if text.as_ref() != self.text || attrs_list != self.attrs_list { - self.text = text.into(); + pub fn set_text>(&mut self, text: T, attrs_list: AttrsList) -> bool { + let text = text.as_ref(); + if text != self.text || attrs_list != self.attrs_list { + self.text.clear(); + self.text.push_str(text); self.attrs_list = attrs_list; self.reset(); true