Skip to content

Commit

Permalink
swap yank command registers
Browse files Browse the repository at this point in the history
helix-editor#8703 swapped the `+` and `*` registers, but did not swap them in the
corresponding yank commands.
  • Loading branch information
dead10ck committed Nov 3, 2023
1 parent ae6a0a9 commit 121ccce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
24 changes: 12 additions & 12 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3897,12 +3897,12 @@ fn yank(cx: &mut Context) {
}

fn yank_to_clipboard(cx: &mut Context) {
yank_impl(cx.editor, '*');
yank_impl(cx.editor, '+');
exit_select_mode(cx);
}

fn yank_to_primary_clipboard(cx: &mut Context) {
yank_impl(cx.editor, '+');
yank_impl(cx.editor, '*');
exit_select_mode(cx);
}

Expand Down Expand Up @@ -3959,13 +3959,13 @@ fn yank_joined(cx: &mut Context) {

fn yank_joined_to_clipboard(cx: &mut Context) {
let line_ending = doc!(cx.editor).line_ending;
yank_joined_impl(cx.editor, line_ending.as_str(), '*');
yank_joined_impl(cx.editor, line_ending.as_str(), '+');
exit_select_mode(cx);
}

fn yank_joined_to_primary_clipboard(cx: &mut Context) {
let line_ending = doc!(cx.editor).line_ending;
yank_joined_impl(cx.editor, line_ending.as_str(), '+');
yank_joined_impl(cx.editor, line_ending.as_str(), '*');
exit_select_mode(cx);
}

Expand All @@ -3982,12 +3982,12 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
}

fn yank_main_selection_to_clipboard(cx: &mut Context) {
yank_primary_selection_impl(cx.editor, '*');
yank_primary_selection_impl(cx.editor, '+');
exit_select_mode(cx);
}

fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
yank_primary_selection_impl(cx.editor, '+');
yank_primary_selection_impl(cx.editor, '*');
exit_select_mode(cx);
}

Expand Down Expand Up @@ -4088,19 +4088,19 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) {
}

fn paste_clipboard_after(cx: &mut Context) {
paste(cx.editor, '*', Paste::After, cx.count());
paste(cx.editor, '+', Paste::After, cx.count());
}

fn paste_clipboard_before(cx: &mut Context) {
paste(cx.editor, '*', Paste::Before, cx.count());
paste(cx.editor, '+', Paste::Before, cx.count());
}

fn paste_primary_clipboard_after(cx: &mut Context) {
paste(cx.editor, '+', Paste::After, cx.count());
paste(cx.editor, '*', Paste::After, cx.count());
}

fn paste_primary_clipboard_before(cx: &mut Context) {
paste(cx.editor, '+', Paste::Before, cx.count());
paste(cx.editor, '*', Paste::Before, cx.count());
}

fn replace_with_yanked(cx: &mut Context) {
Expand Down Expand Up @@ -4138,11 +4138,11 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
}

fn replace_selections_with_clipboard(cx: &mut Context) {
replace_with_yanked_impl(cx.editor, '*', cx.count());
replace_with_yanked_impl(cx.editor, '+', cx.count());
}

fn replace_selections_with_primary_clipboard(cx: &mut Context) {
replace_with_yanked_impl(cx.editor, '+', cx.count());
replace_with_yanked_impl(cx.editor, '*', cx.count());
}

fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
Expand Down
20 changes: 10 additions & 10 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ fn yank_main_selection_to_clipboard(
return Ok(());
}

yank_primary_selection_impl(cx.editor, '*');
yank_primary_selection_impl(cx.editor, '+');
Ok(())
}

Expand Down Expand Up @@ -956,7 +956,7 @@ fn yank_joined_to_clipboard(
let doc = doc!(cx.editor);
let default_sep = Cow::Borrowed(doc.line_ending.as_str());
let separator = args.first().unwrap_or(&default_sep);
yank_joined_impl(cx.editor, separator, '*');
yank_joined_impl(cx.editor, separator, '+');
Ok(())
}

Expand All @@ -969,7 +969,7 @@ fn yank_main_selection_to_primary_clipboard(
return Ok(());
}

yank_primary_selection_impl(cx.editor, '+');
yank_primary_selection_impl(cx.editor, '*');
Ok(())
}

Expand All @@ -985,7 +985,7 @@ fn yank_joined_to_primary_clipboard(
let doc = doc!(cx.editor);
let default_sep = Cow::Borrowed(doc.line_ending.as_str());
let separator = args.first().unwrap_or(&default_sep);
yank_joined_impl(cx.editor, separator, '+');
yank_joined_impl(cx.editor, separator, '*');
Ok(())
}

Expand All @@ -998,7 +998,7 @@ fn paste_clipboard_after(
return Ok(());
}

paste(cx.editor, '*', Paste::After, 1);
paste(cx.editor, '+', Paste::After, 1);
Ok(())
}

Expand All @@ -1011,7 +1011,7 @@ fn paste_clipboard_before(
return Ok(());
}

paste(cx.editor, '*', Paste::Before, 1);
paste(cx.editor, '+', Paste::Before, 1);
Ok(())
}

Expand All @@ -1024,7 +1024,7 @@ fn paste_primary_clipboard_after(
return Ok(());
}

paste(cx.editor, '+', Paste::After, 1);
paste(cx.editor, '*', Paste::After, 1);
Ok(())
}

Expand All @@ -1037,7 +1037,7 @@ fn paste_primary_clipboard_before(
return Ok(());
}

paste(cx.editor, '+', Paste::Before, 1);
paste(cx.editor, '*', Paste::Before, 1);
Ok(())
}

Expand All @@ -1050,7 +1050,7 @@ fn replace_selections_with_clipboard(
return Ok(());
}

replace_with_yanked_impl(cx.editor, '*', 1);
replace_with_yanked_impl(cx.editor, '+', 1);
Ok(())
}

Expand All @@ -1063,7 +1063,7 @@ fn replace_selections_with_primary_clipboard(
return Ok(());
}

replace_with_yanked_impl(cx.editor, '+', 1);
replace_with_yanked_impl(cx.editor, '*', 1);
Ok(())
}

Expand Down

0 comments on commit 121ccce

Please sign in to comment.