on master help sign in
Fix: insert_register (#1751)
05161aaNarazaki Shuji
helix-term/src/commands.rs+7−2
@@ -3038,6 +3038,7 @@ fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
3038enum Paste {
3038enum Paste {
3039 Before,
3039 Before,
3040 After,
3040 After,
3041+ Cursor,
3041}
3042}
3042
3043
3043fn paste_impl(
3044fn paste_impl(
@@ -3084,6 +3085,8 @@ fn paste_impl(
3084 (Paste::Before, false) => range.from(),
3085 (Paste::Before, false) => range.from(),
3085 // paste append
3086 // paste append
3086 (Paste::After, false) => range.to(),
3087 (Paste::After, false) => range.to(),
3088+ // paste at cursor
3089+ (Paste::Cursor, _) => range.cursor(text.slice(..)),
3087 };
3090 };
3088 (pos, pos, values.next())
3091 (pos, pos, values.next())
3089 });
3092 });
@@ -3829,10 +3832,12 @@ fn select_register(cx: &mut Context) {
3829}
3832}
3830
3833
3831fn insert_register(cx: &mut Context) {
3834fn insert_register(cx: &mut Context) {
3835+ cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
3832 cx.on_next_key(move |cx, event| {
3836 cx.on_next_key(move |cx, event| {
3833 if let Some(ch) = event.char() {
3837 if let Some(ch) = event.char() {
3834− cx.editor.selected_register = Some(ch);
3838+ cx.editor.autoinfo = None;
3835− paste_before(cx);
3839+ cx.register = Some(ch);
3840+ paste(cx, Paste::Cursor);
3836 }
3841 }
3837 })
3842 })
3838}
3843}