Rename set_characters method in buffer interface

pull/3/head
Florian Dehau 8 years ago
parent 95a160cf50
commit b0b1645010

@ -105,16 +105,16 @@ impl Buffer {
}
pub fn set_string(&mut self, x: u16, y: u16, string: &str, fg: Color, bg: Color) {
self.set_characters(x, y, string, usize::MAX, fg, bg);
self.set_stringn(x, y, string, usize::MAX, fg, bg);
}
pub fn set_characters(&mut self,
x: u16,
y: u16,
string: &str,
limit: usize,
fg: Color,
bg: Color) {
pub fn set_stringn(&mut self,
x: u16,
y: u16,
string: &str,
limit: usize,
fg: Color,
bg: Color) {
let mut index = self.index_of(x, y);
let graphemes = UnicodeSegmentation::graphemes(string, true).collect::<Vec<&str>>();
let max_index = min((self.area.width - x) as usize, limit);

@ -144,12 +144,12 @@ impl<'a> Widget for BarChart<'a> {
self.bar_color);
}
}
buf.set_characters(chart_area.left() + i as u16 * (self.bar_width + self.bar_gap),
chart_area.bottom() - 1,
label,
self.bar_width as usize,
self.label_color,
Color::Reset);
buf.set_stringn(chart_area.left() + i as u16 * (self.bar_width + self.bar_gap),
chart_area.bottom() - 1,
label,
self.bar_width as usize,
self.label_color,
Color::Reset);
}
}
}

Loading…
Cancel
Save