Make sure the lines exists before applying the alignment
This commit is contained in:
parent
fff8389bbf
commit
260748afe7
1 changed files with 5 additions and 3 deletions
|
|
@ -333,9 +333,11 @@ fn update_alignment<'a, T: Edit<'a>>(editor: &mut T, align: Align) {
|
|||
std::cmp::Ordering::Less => (select.line, current_line),
|
||||
std::cmp::Ordering::Equal => (current_line, current_line),
|
||||
};
|
||||
for line in editor.buffer_mut().lines[start..=end].iter_mut() {
|
||||
line.set_align(Some(align));
|
||||
}
|
||||
editor.buffer_mut().lines.get_mut(start..=end).map(|lines| {
|
||||
for line in lines.iter_mut() {
|
||||
line.set_align(Some(align));
|
||||
}
|
||||
});
|
||||
} else if let Some(line) = editor.buffer_mut().lines.get_mut(current_line) {
|
||||
line.set_align(Some(align));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue