Make Editor::buffer_ref accessible, rename lifetimes

This commit is contained in:
Jeremy Soller 2023-12-19 11:47:25 -07:00
parent cbbf6f0d8f
commit 0a11fb1045
5 changed files with 108 additions and 91 deletions

View file

@ -372,7 +372,7 @@ impl Application for Window {
}
}
fn update_attrs<T: Edit>(editor: &mut T, attrs: Attrs) {
fn update_attrs<'buffer, E: Edit<'buffer>>(editor: &mut E, attrs: Attrs) {
editor.with_buffer_mut(|buffer| {
buffer.lines.iter_mut().for_each(|line| {
line.set_attrs_list(AttrsList::new(attrs));
@ -380,7 +380,7 @@ fn update_attrs<T: Edit>(editor: &mut T, attrs: Attrs) {
});
}
fn update_alignment<T: Edit>(editor: &mut T, align: Align) {
fn update_alignment<'buffer, E: Edit<'buffer>>(editor: &mut E, align: Align) {
let current_line = editor.cursor().line;
let selection_bounds_opt = editor.selection_bounds();
editor.with_buffer_mut(|buffer| {