Update paste_all.

pull/13698/head
Andrew Browne 2025-06-05 19:55:47 -07:00
parent 4f681e8927
commit 0be042c7ee
3 changed files with 14 additions and 12 deletions

View File

@ -488,8 +488,8 @@ impl MappableCommand {
replace_with_yanked, "Replace with yanked text", replace_with_yanked, "Replace with yanked text",
replace_selections_with_clipboard, "Replace selections by clipboard content", replace_selections_with_clipboard, "Replace selections by clipboard content",
replace_selections_with_primary_clipboard, "Replace selections by primary clipboard", replace_selections_with_primary_clipboard, "Replace selections by primary clipboard",
paste_after_all, "Paste all after selection", paste_all_selections_after, "Paste all after selection",
paste_before_all, "Paste all before selection", paste_all_selections_before, "Paste all before selection",
paste_after, "Paste after selection", paste_after, "Paste after selection",
paste_before, "Paste before selection", paste_before, "Paste before selection",
paste_clipboard_after, "Paste clipboard after selections", paste_clipboard_after, "Paste clipboard after selections",
@ -4870,23 +4870,25 @@ fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize, paste_ty
paste_impl(&values, doc, view, pos, count, editor.mode, paste_type); paste_impl(&values, doc, view, pos, count, editor.mode, paste_type);
} }
fn paste_after_all(cx: &mut Context) { fn paste_all_selections_after(cx: &mut Context) {
paste( paste(
cx, cx.editor,
cx.register cx.register
.unwrap_or(cx.editor.config().default_yank_register), .unwrap_or(cx.editor.config().default_yank_register),
Paste::After, Paste::After,
cx.count(),
PasteType::All, PasteType::All,
); );
exit_select_mode(cx); exit_select_mode(cx);
} }
fn paste_before_all(cx: &mut Context) { fn paste_all_selections_before(cx: &mut Context) {
paste( paste(
cx, cx.editor,
cx.register cx.register
.unwrap_or(cx.editor.config().default_yank_register), .unwrap_or(cx.editor.config().default_yank_register),
Paste::Before, Paste::Before,
cx.count(),
PasteType::All, PasteType::All,
); );
exit_select_mode(cx); exit_select_mode(cx);

View File

@ -1039,7 +1039,7 @@ fn paste_clipboard_after(
return Ok(()); return Ok(());
} }
paste(cx.editor, '+', Paste::After, 1); paste(cx.editor, '+', Paste::After, 1, PasteType::Default);
Ok(()) Ok(())
} }
@ -1052,7 +1052,7 @@ fn paste_clipboard_before(
return Ok(()); return Ok(());
} }
paste(cx.editor, '+', Paste::Before, 1); paste(cx.editor, '+', Paste::Before, 1, PasteType::Default);
Ok(()) Ok(())
} }
@ -1065,7 +1065,7 @@ fn paste_primary_clipboard_after(
return Ok(()); return Ok(());
} }
paste(cx.editor, '*', Paste::After, 1); paste(cx.editor, '*', Paste::After, 1, PasteType::Default);
Ok(()) Ok(())
} }
@ -1078,7 +1078,7 @@ fn paste_primary_clipboard_before(
return Ok(()); return Ok(());
} }
paste(cx.editor, '*', Paste::Before, 1); paste(cx.editor, '*', Paste::Before, 1, PasteType::Default);
Ok(()) Ok(())
} }

View File

@ -153,9 +153,9 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
// yank_all // yank_all
"p" => paste_after, "p" => paste_after,
// TODO: This is a terrible mapping, but "A-p" coincides with "select_prev_sibling" // TODO: This is a terrible mapping, but "A-p" coincides with "select_prev_sibling"
"C-p" => paste_after_all, "C-p" => paste_all_selections_after,
"P" => paste_before, "P" => paste_before,
"A-P" => paste_before_all, "A-P" => paste_all_selections_before,
"Q" => record_macro, "Q" => record_macro,
"q" => replay_macro, "q" => replay_macro,