@@ -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
}
@@ -3588,18 +3589,19 @@ fn replace_with_yanked(cx: &mut Context) {
3588
3589
} ) ;
3589
3590
3590
3591
apply_transaction ( & transaction, doc, view) ;
3592
+ exit_select_mode ( cx) ;
3591
3593
}
3592
3594
}
3593
3595
}
3594
3596
3595
3597
fn replace_selections_with_clipboard_impl (
3596
- editor : & mut Editor ,
3598
+ cx : & mut Context ,
3597
3599
clipboard_type : ClipboardType ,
3598
- count : usize ,
3599
3600
) -> anyhow:: Result < ( ) > {
3600
- let ( view, doc) = current ! ( editor) ;
3601
+ let count = cx. count ( ) ;
3602
+ let ( view, doc) = current ! ( cx. editor) ;
3601
3603
3602
- match editor. clipboard_provider . get_contents ( clipboard_type) {
3604
+ match cx . editor . clipboard_provider . get_contents ( clipboard_type) {
3603
3605
Ok ( contents) => {
3604
3606
let selection = doc. selection ( view. id ) ;
3605
3607
let transaction = Transaction :: change_by_selection ( doc. text ( ) , selection, |range| {
@@ -3612,18 +3614,20 @@ fn replace_selections_with_clipboard_impl(
3612
3614
3613
3615
apply_transaction ( & transaction, doc, view) ;
3614
3616
doc. append_changes_to_history ( view. id ) ;
3615
- Ok ( ( ) )
3616
3617
}
3617
- Err ( e) => Err ( e. context ( "Couldn't get system clipboard contents" ) ) ,
3618
+ Err ( e) => return Err ( e. context ( "Couldn't get system clipboard contents" ) ) ,
3618
3619
}
3620
+
3621
+ exit_select_mode ( cx) ;
3622
+ Ok ( ( ) )
3619
3623
}
3620
3624
3621
3625
fn replace_selections_with_clipboard ( cx : & mut Context ) {
3622
- let _ = replace_selections_with_clipboard_impl ( cx. editor , ClipboardType :: Clipboard , cx . count ( ) ) ;
3626
+ let _ = replace_selections_with_clipboard_impl ( cx, ClipboardType :: Clipboard ) ;
3623
3627
}
3624
3628
3625
3629
fn replace_selections_with_primary_clipboard ( cx : & mut Context ) {
3626
- let _ = replace_selections_with_clipboard_impl ( cx. editor , ClipboardType :: Selection , cx . count ( ) ) ;
3630
+ let _ = replace_selections_with_clipboard_impl ( cx, ClipboardType :: Selection ) ;
3627
3631
}
3628
3632
3629
3633
fn paste ( cx : & mut Context , pos : Paste ) {
0 commit comments