add the convenient API for setting tab width

This commit is contained in:
Christian Westrom 2024-09-01 15:45:49 +09:00 committed by Jeremy Soller
parent e16b39f29c
commit 7c25fcb7ae

View file

@ -1379,6 +1379,11 @@ impl<'a> BorrowedWithFontSystem<'a, Buffer> {
.set_metrics_and_size(self.font_system, metrics, width_opt, height_opt);
}
/// Set tab width (number of spaces between tab stops)
pub fn set_tab_width(&mut self, tab_width: u16) {
self.inner.set_tab_width(self.font_system, tab_width);
}
/// Set text of buffer, using provided attributes for each line by default
pub fn set_text(&mut self, text: &str, attrs: Attrs, shaping: Shaping) {
self.inner.set_text(self.font_system, text, attrs, shaping);