Replace skip_shaping boolean with Shaping enum
This commit is contained in:
parent
ad111a1df1
commit
0f055c0a13
5 changed files with 67 additions and 62 deletions
|
|
@ -12,7 +12,7 @@ use unicode_segmentation::UnicodeSegmentation;
|
|||
use crate::Color;
|
||||
use crate::{
|
||||
Attrs, AttrsList, BorrowedWithFontSystem, BufferLine, FontSystem, LayoutGlyph, LayoutLine,
|
||||
ShapeLine, Wrap,
|
||||
ShapeLine, Shaping, Wrap,
|
||||
};
|
||||
|
||||
/// Current cursor location
|
||||
|
|
@ -331,7 +331,7 @@ impl Buffer {
|
|||
redraw: false,
|
||||
wrap: Wrap::Word,
|
||||
};
|
||||
buffer.set_text(font_system, "", Attrs::new(), true);
|
||||
buffer.set_text(font_system, "", Attrs::new(), Shaping::Basic);
|
||||
buffer
|
||||
}
|
||||
|
||||
|
|
@ -567,14 +567,14 @@ impl Buffer {
|
|||
font_system: &mut FontSystem,
|
||||
text: &str,
|
||||
attrs: Attrs,
|
||||
skip_shaping: bool,
|
||||
shaping: Shaping,
|
||||
) {
|
||||
self.lines.clear();
|
||||
for line in text.lines() {
|
||||
self.lines.push(BufferLine::new(
|
||||
line.to_string(),
|
||||
AttrsList::new(attrs),
|
||||
skip_shaping,
|
||||
shaping,
|
||||
));
|
||||
}
|
||||
// Make sure there is always one line
|
||||
|
|
@ -582,7 +582,7 @@ impl Buffer {
|
|||
self.lines.push(BufferLine::new(
|
||||
String::new(),
|
||||
AttrsList::new(attrs),
|
||||
skip_shaping,
|
||||
shaping,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -781,9 +781,8 @@ impl<'a> BorrowedWithFontSystem<'a, Buffer> {
|
|||
}
|
||||
|
||||
/// Set text of buffer, using provided attributes for each line by default
|
||||
pub fn set_text(&mut self, text: &str, attrs: Attrs, skip_shaping: bool) {
|
||||
self.inner
|
||||
.set_text(self.font_system, text, attrs, skip_shaping);
|
||||
pub fn set_text(&mut self, text: &str, attrs: Attrs, shaping: Shaping) {
|
||||
self.inner.set_text(self.font_system, text, attrs, shaping);
|
||||
}
|
||||
|
||||
/// Draw the buffer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue