on master help sign in
Fix crash on xa<Enter> if we were on the last line.
commit354b822d21ca82dc6a761d67cd92e4e00f855da5 authorBlaž Hrastnik <blaz@mxxn.io> dateSat 15 May 2021, 10:46 (5 years ago) parentfae2127
1 file changed+11
helix-term/src/commands.rs+11
helix-term/src/commands.rs+11
@@ -823,6 +823,17 @@ pub fn append_mode(cx: &mut Context) {
823823 graphemes::next_grapheme_boundary(text, range.to()), // to() + next char
824824 )
825825 });
826+
827+ let end = text.len_chars();
828+
829+ if selection.iter().any(|range| range.head == end) {
830+ let transaction = Transaction::change(
831+ doc.text(),
832+ vec![(end, end, Some(Tendril::from_char('\n')))].into_iter(),
833+ );
834+ doc.apply(&transaction, view.id);
835+ }
836+
826837 doc.set_selection(view.id, selection);
827838}
828839