@ -4174,7 +4174,7 @@ fn yank_joined_to_primary_clipboard(cx: &mut Context) {
exit_select_mode ( cx ) ;
exit_select_mode ( cx ) ;
}
}
fn yank_primary_selection_impl ( editor : & mut Editor , register : char ) {
pub( crate ) fn yank_main_selection_to_register ( editor : & mut Editor , register : char ) {
let ( view , doc ) = current ! ( editor ) ;
let ( view , doc ) = current ! ( editor ) ;
let text = doc . text ( ) . slice ( .. ) ;
let text = doc . text ( ) . slice ( .. ) ;
@ -4187,17 +4187,17 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
}
}
fn yank_main_selection_to_clipboard ( cx : & mut Context ) {
fn yank_main_selection_to_clipboard ( cx : & mut Context ) {
yank_ primary_selection_impl ( cx . editor , '+' ) ;
yank_ main_selection_to_register ( cx . editor , '+' ) ;
exit_select_mode ( cx ) ;
exit_select_mode ( cx ) ;
}
}
fn yank_main_selection_to_primary_clipboard ( cx : & mut Context ) {
fn yank_main_selection_to_primary_clipboard ( cx : & mut Context ) {
yank_ primary_selection_impl ( cx . editor , '*' ) ;
yank_ main_selection_to_register ( cx . editor , '*' ) ;
exit_select_mode ( cx ) ;
exit_select_mode ( cx ) ;
}
}
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
enum Paste {
pub ( crate ) enum Paste {
Before ,
Before ,
After ,
After ,
Cursor ,
Cursor ,
@ -4314,11 +4314,11 @@ fn paste_primary_clipboard_before(cx: &mut Context) {
}
}
fn replace_with_yanked ( cx : & mut Context ) {
fn replace_with_yanked ( cx : & mut Context ) {
replace_ with_yanked_impl ( cx . editor , cx . register . unwrap_or ( '"' ) , cx . count ( ) ) ;
replace_ selections_with_register ( cx . editor , cx . register . unwrap_or ( '"' ) , cx . count ( ) ) ;
exit_select_mode ( cx ) ;
exit_select_mode ( cx ) ;
}
}
fn replace_with_yanked_impl ( editor : & mut Editor , register : char , count : usize ) {
pub( crate ) fn replace_selections_with_register ( editor : & mut Editor , register : char , count : usize ) {
let Some ( values ) = editor
let Some ( values ) = editor
. registers
. registers
. read ( register , editor )
. read ( register , editor )
@ -4355,16 +4355,16 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
}
}
fn replace_selections_with_clipboard ( cx : & mut Context ) {
fn replace_selections_with_clipboard ( cx : & mut Context ) {
replace_ with_yanked_impl ( cx . editor , '+' , cx . count ( ) ) ;
replace_ selections_with_register ( cx . editor , '+' , cx . count ( ) ) ;
exit_select_mode ( cx ) ;
exit_select_mode ( cx ) ;
}
}
fn replace_selections_with_primary_clipboard ( cx : & mut Context ) {
fn replace_selections_with_primary_clipboard ( cx : & mut Context ) {
replace_ with_yanked_impl ( cx . editor , '*' , cx . count ( ) ) ;
replace_ selections_with_register ( cx . editor , '*' , cx . count ( ) ) ;
exit_select_mode ( cx ) ;
exit_select_mode ( cx ) ;
}
}
fn paste ( editor : & mut Editor , register : char , pos : Paste , count : usize ) {
pub ( crate ) fn paste ( editor : & mut Editor , register : char , pos : Paste , count : usize ) {
let Some ( values ) = editor . registers . read ( register , editor ) else {
let Some ( values ) = editor . registers . read ( register , editor ) else {
return ;
return ;
} ;
} ;