aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorNarazaki Shuji2022-03-13 08:23:55 +0000
committerGitHub2022-03-13 08:23:55 +0000
commit05161aa85e14ec6cd84234d724639289027284fe (patch)
tree2c57b93fee4d33e10c02910fc08669a250b52256 /helix-term
parente8cc7ace759c2aaf3a14257a5c48e0f8a960d4cd (diff)
Fix: insert_register (#1751)
- set register name correctly - use autoinfo to display register contents - call `paste` with `Paste::Cursor`
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index b9401d40..844f6690 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3038,6 +3038,7 @@ fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
enum Paste {
Before,
After,
+ Cursor,
}
fn paste_impl(
@@ -3084,6 +3085,8 @@ fn paste_impl(
(Paste::Before, false) => range.from(),
// paste append
(Paste::After, false) => range.to(),
+ // paste at cursor
+ (Paste::Cursor, _) => range.cursor(text.slice(..)),
};
(pos, pos, values.next())
});
@@ -3829,10 +3832,12 @@ fn select_register(cx: &mut Context) {
}
fn insert_register(cx: &mut Context) {
+ cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
cx.on_next_key(move |cx, event| {
if let Some(ch) = event.char() {
- cx.editor.selected_register = Some(ch);
- paste_before(cx);
+ cx.editor.autoinfo = None;
+ cx.register = Some(ch);
+ paste(cx, Paste::Cursor);
}
})
}