@@ -922,18 +922,25 @@ fn selection_lines(doc: &Rope, selection: &Selection) -> Vec<usize> {
923// I inserts at the start of each line with a selection
923// I inserts at the start of each line with a selection
924pub fn prepend_to_line(cx: &mut Context) {
924pub fn prepend_to_line(cx: &mut Context) {
925+ move_line_start(cx);
925 let doc = cx.doc();
926 let doc = cx.doc();
926 enter_insert_mode(doc);
927 enter_insert_mode(doc);
928− move_line_start(cx);
931// A inserts at the end of each line with a selection
930// A inserts at the end of each line with a selection
932pub fn append_to_line(cx: &mut Context) {
931pub fn append_to_line(cx: &mut Context) {
933 let doc = cx.doc();
934 let doc = cx.doc();
934 enter_insert_mode(doc);
935 enter_insert_mode(doc);
936− move_line_end(cx);
937+ // offset by another 1 char since move_line_end will position on the last char, we want to
939+ let selection = doc.selection().transform(|range| {
940+ let pos = range.head + 1;
941+ Range::new(pos, pos)
943+ doc.set_selection(selection);
939// o inserts a new line after each line with a selection
946// o inserts a new line after each line with a selection