on master help sign in
swap yank command registers (#8708)

#8703 swapped the `+` and `*` registers, but did not swap them in the corresponding yank commands.

commit10b178e94b0d3c44c56f5cd573ff65b3249aea78 authorSkyler Hawthorne <skyler@dead10ck.com> dateFri 3 Nov 2023, 20:35 (3 years ago) parent8dc1977
3 files changed+24−24
book/src/usage.md+2−2 helix-term/src/commands.rs+12−12 helix-term/src/commands/typed.rs+10−10
book/src/usage.md+2−2
@@ -59,8 +59,8 @@ Some registers have special behavior when read from and written to.
5959| `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable |
6060| `.` | Contents of the current selections | This register is not writable |
6161| `%` | Name of the current file | This register is not writable |
62−| `*` | Reads from the system clipboard | Joins and yanks to the system clipboard |
63−| `+` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
62+| `+` | Reads from the system clipboard | Joins and yanks to the system clipboard |
63+| `*` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
6464
6565When yanking multiple selections to the clipboard registers, the selections
6666are joined with newlines. Pasting from these registers will paste multiple
helix-term/src/commands.rs+12−12
@@ -3897,12 +3897,12 @@ fn yank(cx: &mut Context) {
38973897}
38983898
38993899fn yank_to_clipboard(cx: &mut Context) {
3900− yank_impl(cx.editor, '*');
3900+ yank_impl(cx.editor, '+');
39013901 exit_select_mode(cx);
39023902}
39033903
39043904fn yank_to_primary_clipboard(cx: &mut Context) {
3905− yank_impl(cx.editor, '+');
3905+ yank_impl(cx.editor, '*');
39063906 exit_select_mode(cx);
39073907}
39083908
@@ -3959,13 +3959,13 @@ fn yank_joined(cx: &mut Context) {
39593959
39603960fn yank_joined_to_clipboard(cx: &mut Context) {
39613961 let line_ending = doc!(cx.editor).line_ending;
3962− yank_joined_impl(cx.editor, line_ending.as_str(), '*');
3962+ yank_joined_impl(cx.editor, line_ending.as_str(), '+');
39633963 exit_select_mode(cx);
39643964}
39653965
39663966fn yank_joined_to_primary_clipboard(cx: &mut Context) {
39673967 let line_ending = doc!(cx.editor).line_ending;
3968− yank_joined_impl(cx.editor, line_ending.as_str(), '+');
3968+ yank_joined_impl(cx.editor, line_ending.as_str(), '*');
39693969 exit_select_mode(cx);
39703970}
39713971
@@ -3982,12 +3982,12 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
39823982}
39833983
39843984fn yank_main_selection_to_clipboard(cx: &mut Context) {
3985− yank_primary_selection_impl(cx.editor, '*');
3985+ yank_primary_selection_impl(cx.editor, '+');
39863986 exit_select_mode(cx);
39873987}
39883988
39893989fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
3990− yank_primary_selection_impl(cx.editor, '+');
3990+ yank_primary_selection_impl(cx.editor, '*');
39913991 exit_select_mode(cx);
39923992}
39933993
@@ -4088,19 +4088,19 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) {
40884088}
40894089
40904090fn paste_clipboard_after(cx: &mut Context) {
4091− paste(cx.editor, '*', Paste::After, cx.count());
4091+ paste(cx.editor, '+', Paste::After, cx.count());
40924092}
40934093
40944094fn paste_clipboard_before(cx: &mut Context) {
4095− paste(cx.editor, '*', Paste::Before, cx.count());
4095+ paste(cx.editor, '+', Paste::Before, cx.count());
40964096}
40974097
40984098fn paste_primary_clipboard_after(cx: &mut Context) {
4099− paste(cx.editor, '+', Paste::After, cx.count());
4099+ paste(cx.editor, '*', Paste::After, cx.count());
41004100}
41014101
41024102fn paste_primary_clipboard_before(cx: &mut Context) {
4103− paste(cx.editor, '+', Paste::Before, cx.count());
4103+ paste(cx.editor, '*', Paste::Before, cx.count());
41044104}
41054105
41064106fn replace_with_yanked(cx: &mut Context) {
@@ -4138,11 +4138,11 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
41384138}
41394139
41404140fn replace_selections_with_clipboard(cx: &mut Context) {
4141− replace_with_yanked_impl(cx.editor, '*', cx.count());
4141+ replace_with_yanked_impl(cx.editor, '+', cx.count());
41424142}
41434143
41444144fn replace_selections_with_primary_clipboard(cx: &mut Context) {
4145− replace_with_yanked_impl(cx.editor, '+', cx.count());
4145+ replace_with_yanked_impl(cx.editor, '*', cx.count());
41464146}
41474147
41484148fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
helix-term/src/commands/typed.rs+10−10
@@ -921,7 +921,7 @@ fn yank_main_selection_to_clipboard(
921921 return Ok(());
922922 }
923923
924− yank_primary_selection_impl(cx.editor, '*');
924+ yank_primary_selection_impl(cx.editor, '+');
925925 Ok(())
926926}
927927
@@ -956,7 +956,7 @@ fn yank_joined_to_clipboard(
956956 let doc = doc!(cx.editor);
957957 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
958958 let separator = args.first().unwrap_or(&default_sep);
959− yank_joined_impl(cx.editor, separator, '*');
959+ yank_joined_impl(cx.editor, separator, '+');
960960 Ok(())
961961}
962962
@@ -969,7 +969,7 @@ fn yank_main_selection_to_primary_clipboard(
969969 return Ok(());
970970 }
971971
972− yank_primary_selection_impl(cx.editor, '+');
972+ yank_primary_selection_impl(cx.editor, '*');
973973 Ok(())
974974}
975975
@@ -985,7 +985,7 @@ fn yank_joined_to_primary_clipboard(
985985 let doc = doc!(cx.editor);
986986 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
987987 let separator = args.first().unwrap_or(&default_sep);
988− yank_joined_impl(cx.editor, separator, '+');
988+ yank_joined_impl(cx.editor, separator, '*');
989989 Ok(())
990990}
991991
@@ -998,7 +998,7 @@ fn paste_clipboard_after(
998998 return Ok(());
999999 }
10001000
1001− paste(cx.editor, '*', Paste::After, 1);
1001+ paste(cx.editor, '+', Paste::After, 1);
10021002 Ok(())
10031003}
10041004
@@ -1011,7 +1011,7 @@ fn paste_clipboard_before(
10111011 return Ok(());
10121012 }
10131013
1014− paste(cx.editor, '*', Paste::Before, 1);
1014+ paste(cx.editor, '+', Paste::Before, 1);
10151015 Ok(())
10161016}
10171017
@@ -1024,7 +1024,7 @@ fn paste_primary_clipboard_after(
10241024 return Ok(());
10251025 }
10261026
1027− paste(cx.editor, '+', Paste::After, 1);
1027+ paste(cx.editor, '*', Paste::After, 1);
10281028 Ok(())
10291029}
10301030
@@ -1037,7 +1037,7 @@ fn paste_primary_clipboard_before(
10371037 return Ok(());
10381038 }
10391039
1040− paste(cx.editor, '+', Paste::Before, 1);
1040+ paste(cx.editor, '*', Paste::Before, 1);
10411041 Ok(())
10421042}
10431043
@@ -1050,7 +1050,7 @@ fn replace_selections_with_clipboard(
10501050 return Ok(());
10511051 }
10521052
1053− replace_with_yanked_impl(cx.editor, '*', 1);
1053+ replace_with_yanked_impl(cx.editor, '+', 1);
10541054 Ok(())
10551055}
10561056
@@ -1063,7 +1063,7 @@ fn replace_selections_with_primary_clipboard(
10631063 return Ok(());
10641064 }
10651065
1066− replace_with_yanked_impl(cx.editor, '+', 1);
1066+ replace_with_yanked_impl(cx.editor, '*', 1);
10671067 Ok(())
10681068}
10691069