@@ -1304,6 +1304,7 @@ fn replace(cx: &mut Context) {
1304
1304
} ) ;
1305
1305
1306
1306
apply_transaction ( & transaction, doc, view) ;
1307
+ exit_select_mode ( cx) ;
1307
1308
}
1308
1309
} )
1309
1310
}
@@ -3581,18 +3582,19 @@ fn replace_with_yanked(cx: &mut Context) {
3581
3582
} ) ;
3582
3583
3583
3584
apply_transaction ( & transaction, doc, view) ;
3585
+ exit_select_mode ( cx) ;
3584
3586
}
3585
3587
}
3586
3588
}
3587
3589
3588
3590
fn replace_selections_with_clipboard_impl (
3589
- editor : & mut Editor ,
3591
+ cx : & mut Context ,
3590
3592
clipboard_type : ClipboardType ,
3591
- count : usize ,
3592
3593
) -> anyhow:: Result < ( ) > {
3593
- let ( view, doc) = current ! ( editor) ;
3594
+ let count = cx. count ( ) ;
3595
+ let ( view, doc) = current ! ( cx. editor) ;
3594
3596
3595
- match editor. clipboard_provider . get_contents ( clipboard_type) {
3597
+ match cx . editor . clipboard_provider . get_contents ( clipboard_type) {
3596
3598
Ok ( contents) => {
3597
3599
let selection = doc. selection ( view. id ) ;
3598
3600
let transaction = Transaction :: change_by_selection ( doc. text ( ) , selection, |range| {
@@ -3605,18 +3607,20 @@ fn replace_selections_with_clipboard_impl(
3605
3607
3606
3608
apply_transaction ( & transaction, doc, view) ;
3607
3609
doc. append_changes_to_history ( view. id ) ;
3608
- Ok ( ( ) )
3609
3610
}
3610
- Err ( e) => Err ( e. context ( "Couldn't get system clipboard contents" ) ) ,
3611
+ Err ( e) => return Err ( e. context ( "Couldn't get system clipboard contents" ) ) ,
3611
3612
}
3613
+
3614
+ exit_select_mode ( cx) ;
3615
+ Ok ( ( ) )
3612
3616
}
3613
3617
3614
3618
fn replace_selections_with_clipboard ( cx : & mut Context ) {
3615
- let _ = replace_selections_with_clipboard_impl ( cx. editor , ClipboardType :: Clipboard , cx . count ( ) ) ;
3619
+ let _ = replace_selections_with_clipboard_impl ( cx, ClipboardType :: Clipboard ) ;
3616
3620
}
3617
3621
3618
3622
fn replace_selections_with_primary_clipboard ( cx : & mut Context ) {
3619
- let _ = replace_selections_with_clipboard_impl ( cx. editor , ClipboardType :: Selection , cx . count ( ) ) ;
3623
+ let _ = replace_selections_with_clipboard_impl ( cx, ClipboardType :: Selection ) ;
3620
3624
}
3621
3625
3622
3626
fn paste ( cx : & mut Context , pos : Paste ) {
0 commit comments