@@ -25,7 +25,7 @@ use helix_view::{
25
25
keyboard:: { KeyCode , KeyModifiers } ,
26
26
Document , Editor , Theme , View ,
27
27
} ;
28
- use std:: { borrow:: Cow , cmp:: min, path:: PathBuf } ;
28
+ use std:: { borrow:: Cow , cmp:: min, num :: NonZeroUsize , path:: PathBuf } ;
29
29
30
30
use tui:: buffer:: Buffer as Surface ;
31
31
@@ -1011,37 +1011,40 @@ impl EditorView {
1011
1011
}
1012
1012
// special handling for repeat operator
1013
1013
( key ! ( '.' ) , _) if self . keymaps . pending ( ) . is_empty ( ) => {
1014
- // first execute whatever put us into insert mode
1015
- self . last_insert . 0 . execute ( cxt) ;
1016
- // then replay the inputs
1017
- for key in self . last_insert . 1 . clone ( ) {
1018
- match key {
1019
- InsertEvent :: Key ( key) => self . insert_mode ( cxt, key) ,
1020
- InsertEvent :: CompletionApply ( compl) => {
1021
- let ( view, doc) = current ! ( cxt. editor) ;
1022
-
1023
- doc. restore ( view) ;
1024
-
1025
- let text = doc. text ( ) . slice ( ..) ;
1026
- let cursor = doc. selection ( view. id ) . primary ( ) . cursor ( text) ;
1027
-
1028
- let shift_position =
1029
- |pos : usize | -> usize { pos + cursor - compl. trigger_offset } ;
1030
-
1031
- let tx = Transaction :: change (
1032
- doc. text ( ) ,
1033
- compl. changes . iter ( ) . cloned ( ) . map ( |( start, end, t) | {
1034
- ( shift_position ( start) , shift_position ( end) , t)
1035
- } ) ,
1036
- ) ;
1037
- apply_transaction ( & tx, doc, view) ;
1038
- }
1039
- InsertEvent :: TriggerCompletion => {
1040
- let ( _, doc) = current ! ( cxt. editor) ;
1041
- doc. savepoint ( ) ;
1014
+ for _ in 0 ..cxt. editor . count . map_or ( 1 , NonZeroUsize :: into) {
1015
+ // first execute whatever put us into insert mode
1016
+ self . last_insert . 0 . execute ( cxt) ;
1017
+ // then replay the inputs
1018
+ for key in self . last_insert . 1 . clone ( ) {
1019
+ match key {
1020
+ InsertEvent :: Key ( key) => self . insert_mode ( cxt, key) ,
1021
+ InsertEvent :: CompletionApply ( compl) => {
1022
+ let ( view, doc) = current ! ( cxt. editor) ;
1023
+
1024
+ doc. restore ( view) ;
1025
+
1026
+ let text = doc. text ( ) . slice ( ..) ;
1027
+ let cursor = doc. selection ( view. id ) . primary ( ) . cursor ( text) ;
1028
+
1029
+ let shift_position =
1030
+ |pos : usize | -> usize { pos + cursor - compl. trigger_offset } ;
1031
+
1032
+ let tx = Transaction :: change (
1033
+ doc. text ( ) ,
1034
+ compl. changes . iter ( ) . cloned ( ) . map ( |( start, end, t) | {
1035
+ ( shift_position ( start) , shift_position ( end) , t)
1036
+ } ) ,
1037
+ ) ;
1038
+ apply_transaction ( & tx, doc, view) ;
1039
+ }
1040
+ InsertEvent :: TriggerCompletion => {
1041
+ let ( _, doc) = current ! ( cxt. editor) ;
1042
+ doc. savepoint ( ) ;
1043
+ }
1042
1044
}
1043
1045
}
1044
1046
}
1047
+ cxt. editor . count = None ;
1045
1048
}
1046
1049
_ => {
1047
1050
// set the count
0 commit comments