fix for test.sh
This commit is contained in:
parent
53763c157b
commit
e828131c92
15 changed files with 136 additions and 109 deletions
|
|
@ -380,7 +380,7 @@ impl<'buffer> Edit<'buffer> for Editor<'buffer> {
|
|||
let line = BufferLine::new(
|
||||
String::new(),
|
||||
ending,
|
||||
AttrsList::new(attrs_list.as_ref().map_or_else(
|
||||
AttrsList::new(&attrs_list.as_ref().map_or_else(
|
||||
|| {
|
||||
buffer
|
||||
.lines
|
||||
|
|
@ -404,7 +404,7 @@ impl<'buffer> Edit<'buffer> for Editor<'buffer> {
|
|||
|
||||
// Collect attributes
|
||||
let mut final_attrs = attrs_list.unwrap_or_else(|| {
|
||||
AttrsList::new(line.attrs_list().get_span(cursor.index.saturating_sub(1)))
|
||||
AttrsList::new(&line.attrs_list().get_span(cursor.index.saturating_sub(1)))
|
||||
});
|
||||
|
||||
// Append the inserted text, line by line
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ impl<'syntax_system, 'buffer> SyntaxEditor<'syntax_system, 'buffer> {
|
|||
foreground.a,
|
||||
));
|
||||
}
|
||||
line.set_attrs_list(AttrsList::new(attrs));
|
||||
line.set_attrs_list(AttrsList::new(&attrs));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ impl<'syntax_system, 'buffer> SyntaxEditor<'syntax_system, 'buffer> {
|
|||
|
||||
let text = fs::read_to_string(path)?;
|
||||
self.editor.with_buffer_mut(|buffer| {
|
||||
buffer.set_text(font_system, &text, attrs, Shaping::Advanced);
|
||||
buffer.set_text(font_system, &text, &attrs, Shaping::Advanced);
|
||||
});
|
||||
|
||||
//TODO: re-use text
|
||||
|
|
@ -332,9 +332,11 @@ impl<'buffer> Edit<'buffer> for SyntaxEditor<'_, 'buffer> {
|
|||
);
|
||||
|
||||
let attrs = line.attrs_list().defaults();
|
||||
let mut attrs_list = AttrsList::new(attrs);
|
||||
let mut attrs_list = AttrsList::new(&attrs);
|
||||
let original_attrs = attrs.clone(); // Store a clone for comparison
|
||||
for (style, _, range) in ranges {
|
||||
let span_attrs = attrs
|
||||
.clone() // Clone attrs for modification
|
||||
.color(Color::rgba(
|
||||
style.foreground.r,
|
||||
style.foreground.g,
|
||||
|
|
@ -352,8 +354,8 @@ impl<'buffer> Edit<'buffer> for SyntaxEditor<'_, 'buffer> {
|
|||
} else {
|
||||
Weight::NORMAL
|
||||
}); //TODO: underline
|
||||
if span_attrs != attrs {
|
||||
attrs_list.add_span(range, span_attrs);
|
||||
if span_attrs != original_attrs {
|
||||
attrs_list.add_span(range, &span_attrs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue