@@ -173,6 +173,10 @@ impl Command {
176+ pub fn fun(&self) -> fn(&mut Context) {
176 #[rustfmt::skip]
180 #[rustfmt::skip]
177 commands!(
181 commands!(
178 no_op, "Do nothing",
182 no_op, "Do nothing",
@@ -603,8 +607,15 @@ fn kill_to_line_end(cx: &mut Context) {
604 let selection = doc.selection(view.id).clone().transform(|range| {
608 let selection = doc.selection(view.id).clone().transform(|range| {
605 let line = range.cursor_line(text);
609 let line = range.cursor_line(text);
606− let pos = line_end_char_index(&text, line);
610+ let line_end_pos = line_end_char_index(&text, line);
611+ let pos = range.cursor(text);
607− range.put_cursor(text, pos, true)
613+ let mut new_range = range.put_cursor(text, line_end_pos, true);
614+ // don't want to remove the line separator itself if the cursor doesn't reach the end of line.
615+ if pos != line_end_pos {
616+ new_range.head = line_end_pos;
609 delete_selection_insert_mode(doc, view, &selection);
620 delete_selection_insert_mode(doc, view, &selection);
@@ -3503,12 +3514,12 @@ fn open(cx: &mut Context, open: Open) {
3505// o inserts a new line after each line with a selection
3516// o inserts a new line after each line with a selection
3506−fn open_below(cx: &mut Context) {
3517+pub(crate) fn open_below(cx: &mut Context) {
3507 open(cx, Open::Below)
3518 open(cx, Open::Below)
3510// O inserts a new line before each line with a selection
3521// O inserts a new line before each line with a selection
3511−fn open_above(cx: &mut Context) {
3522+pub(crate) fn open_above(cx: &mut Context) {
3512 open(cx, Open::Above)
3523 open(cx, Open::Above)