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

pull/11/head
Blaž Hrastnik 4 years ago
parent fae2127a11
commit 354b822d21

@ -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);
} }

Loading…
Cancel
Save