@@ -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
@@ -1009,37 +1009,40 @@ impl EditorView {
1009
1009
}
1010
1010
// special handling for repeat operator
1011
1011
( key ! ( '.' ) , _) if self . keymaps . pending ( ) . is_empty ( ) => {
1012
- // first execute whatever put us into insert mode
1013
- self . last_insert . 0 . execute ( cxt) ;
1014
- // then replay the inputs
1015
- for key in self . last_insert . 1 . clone ( ) {
1016
- match key {
1017
- InsertEvent :: Key ( key) => self . insert_mode ( cxt, key) ,
1018
- InsertEvent :: CompletionApply ( compl) => {
1019
- let ( view, doc) = current ! ( cxt. editor) ;
1020
-
1021
- doc. restore ( view) ;
1022
-
1023
- let text = doc. text ( ) . slice ( ..) ;
1024
- let cursor = doc. selection ( view. id ) . primary ( ) . cursor ( text) ;
1025
-
1026
- let shift_position =
1027
- |pos : usize | -> usize { pos + cursor - compl. trigger_offset } ;
1028
-
1029
- let tx = Transaction :: change (
1030
- doc. text ( ) ,
1031
- compl. changes . iter ( ) . cloned ( ) . map ( |( start, end, t) | {
1032
- ( shift_position ( start) , shift_position ( end) , t)
1033
- } ) ,
1034
- ) ;
1035
- apply_transaction ( & tx, doc, view) ;
1036
- }
1037
- InsertEvent :: TriggerCompletion => {
1038
- let ( _, doc) = current ! ( cxt. editor) ;
1039
- doc. savepoint ( ) ;
1012
+ for _ in 0 ..cxt. editor . count . map_or ( 1 , NonZeroUsize :: into) {
1013
+ // first execute whatever put us into insert mode
1014
+ self . last_insert . 0 . execute ( cxt) ;
1015
+ // then replay the inputs
1016
+ for key in self . last_insert . 1 . clone ( ) {
1017
+ match key {
1018
+ InsertEvent :: Key ( key) => self . insert_mode ( cxt, key) ,
1019
+ InsertEvent :: CompletionApply ( compl) => {
1020
+ let ( view, doc) = current ! ( cxt. editor) ;
1021
+
1022
+ doc. restore ( view) ;
1023
+
1024
+ let text = doc. text ( ) . slice ( ..) ;
1025
+ let cursor = doc. selection ( view. id ) . primary ( ) . cursor ( text) ;
1026
+
1027
+ let shift_position =
1028
+ |pos : usize | -> usize { pos + cursor - compl. trigger_offset } ;
1029
+
1030
+ let tx = Transaction :: change (
1031
+ doc. text ( ) ,
1032
+ compl. changes . iter ( ) . cloned ( ) . map ( |( start, end, t) | {
1033
+ ( shift_position ( start) , shift_position ( end) , t)
1034
+ } ) ,
1035
+ ) ;
1036
+ apply_transaction ( & tx, doc, view) ;
1037
+ }
1038
+ InsertEvent :: TriggerCompletion => {
1039
+ let ( _, doc) = current ! ( cxt. editor) ;
1040
+ doc. savepoint ( ) ;
1041
+ }
1040
1042
}
1041
1043
}
1042
1044
}
1045
+ cxt. editor . count = None ;
1043
1046
}
1044
1047
_ => {
1045
1048
// set the count
0 commit comments