Fix crash on xa<Enter> if we were on the last line.

This commit is contained in:
Blaž Hrastnik 2021-05-15 10:46:59 +09:00
parent fae2127a11
commit 354b822d21

View File

@ -823,6 +823,17 @@ pub fn append_mode(cx: &mut Context) {
graphemes::next_grapheme_boundary(text, range.to()), // to() + next char graphemes::next_grapheme_boundary(text, range.to()), // to() + next char
) )
}); });
let end = text.len_chars();
if selection.iter().any(|range| range.head == end) {
let transaction = Transaction::change(
doc.text(),
vec![(end, end, Some(Tendril::from_char('\n')))].into_iter(),
);
doc.apply(&transaction, view.id);
}
doc.set_selection(view.id, selection); doc.set_selection(view.id, selection);
} }