@@ -1826,10 +1826,11 @@ fn open(cx: &mut Context, open: Open) {
1828 // insert newlines after this index for both Above and Below variants
1828 // insert newlines after this index for both Above and Below variants
1829− let linend_index = doc.text().line_to_char(line)
1829+ let linend_index = doc.text().line_to_char(line).saturating_sub(
1830− - get_line_ending(&doc.text().line(line))
1830+ get_line_ending(&doc.text().line(line))
1831 .map(|le| le.len_chars())
1831 .map(|le| le.len_chars())
1832− .unwrap_or(0);
1832+ .unwrap_or(0),
1834 // TODO: share logic with insert_newline for indentation
1835 // TODO: share logic with insert_newline for indentation
1835 let indent_level = indent::suggested_indent_for_pos(
1836 let indent_level = indent::suggested_indent_for_pos(