@@ -1307,6 +1307,7 @@ fn replace(cx: &mut Context) {
1307
1307
} ) ;
1308
1308
1309
1309
apply_transaction ( & transaction, doc, view) ;
1310
+ exit_select_mode ( cx) ;
1310
1311
}
1311
1312
} )
1312
1313
}
@@ -3621,18 +3622,19 @@ fn replace_with_yanked(cx: &mut Context) {
3621
3622
} ) ;
3622
3623
3623
3624
apply_transaction ( & transaction, doc, view) ;
3625
+ exit_select_mode ( cx) ;
3624
3626
}
3625
3627
}
3626
3628
}
3627
3629
3628
3630
fn replace_selections_with_clipboard_impl (
3629
- editor : & mut Editor ,
3631
+ cx : & mut Context ,
3630
3632
clipboard_type : ClipboardType ,
3631
- count : usize ,
3632
3633
) -> anyhow:: Result < ( ) > {
3633
- let ( view, doc) = current ! ( editor) ;
3634
+ let count = cx. count ( ) ;
3635
+ let ( view, doc) = current ! ( cx. editor) ;
3634
3636
3635
- match editor. clipboard_provider . get_contents ( clipboard_type) {
3637
+ match cx . editor . clipboard_provider . get_contents ( clipboard_type) {
3636
3638
Ok ( contents) => {
3637
3639
let selection = doc. selection ( view. id ) ;
3638
3640
let transaction = Transaction :: change_by_selection ( doc. text ( ) , selection, |range| {
@@ -3645,18 +3647,20 @@ fn replace_selections_with_clipboard_impl(
3645
3647
3646
3648
apply_transaction ( & transaction, doc, view) ;
3647
3649
doc. append_changes_to_history ( view. id ) ;
3648
- Ok ( ( ) )
3649
3650
}
3650
- Err ( e) => Err ( e. context ( "Couldn't get system clipboard contents" ) ) ,
3651
+ Err ( e) => return Err ( e. context ( "Couldn't get system clipboard contents" ) ) ,
3651
3652
}
3653
+
3654
+ exit_select_mode ( cx) ;
3655
+ Ok ( ( ) )
3652
3656
}
3653
3657
3654
3658
fn replace_selections_with_clipboard ( cx : & mut Context ) {
3655
- let _ = replace_selections_with_clipboard_impl ( cx. editor , ClipboardType :: Clipboard , cx . count ( ) ) ;
3659
+ let _ = replace_selections_with_clipboard_impl ( cx, ClipboardType :: Clipboard ) ;
3656
3660
}
3657
3661
3658
3662
fn replace_selections_with_primary_clipboard ( cx : & mut Context ) {
3659
- let _ = replace_selections_with_clipboard_impl ( cx. editor , ClipboardType :: Selection , cx . count ( ) ) ;
3663
+ let _ = replace_selections_with_clipboard_impl ( cx, ClipboardType :: Selection ) ;
3660
3664
}
3661
3665
3662
3666
fn paste ( cx : & mut Context , pos : Paste ) {
0 commit comments