@@ -666,6 +666,9 @@ macro_rules! change_range {
666666 ( $rt: expr) => {
667667 change_target!( EditTarget :: Range ( $rt, true , Count :: Contextual ) )
668668 } ;
669+ ( $rt: expr, $inc: expr) => {
670+ change_target!( EditTarget :: Range ( $rt, $inc, Count :: Contextual ) )
671+ } ;
669672}
670673
671674macro_rules! change {
@@ -1536,7 +1539,7 @@ fn default_keys<I: ApplicationInfo>() -> Vec<(MappedModes, &'static str, InputSt
15361539 ( NMAP , "a" , insert ! ( InsertStyle :: Insert , MoveType :: Column ( MoveDir1D :: Next , false ) ) ) ,
15371540 ( NMAP , "A" , insert ! ( InsertStyle :: Insert , MoveType :: LinePos ( MovePosition :: End ) , 0 ) ) ,
15381541 ( NMAP , "c" , edit_motion ! ( EditAction :: Delete , VimMode :: Insert , InsertStyle :: Insert ) ) ,
1539- ( NMAP , "cc" , change_range ! ( RangeType :: Line ) ) ,
1542+ ( NMAP , "cc" , edit_range_end ! ( RangeType :: Line , false ) ) ,
15401543 ( NMAP , "cw" , edit_end ! ( MoveType :: WordEnd ( WordStyle :: Little , MoveDir1D :: Next ) ) ) ,
15411544 ( NMAP , "cW" , edit_end ! ( MoveType :: WordEnd ( WordStyle :: Big , MoveDir1D :: Next ) ) ) ,
15421545 ( NMAP , "C" , change ! ( MoveType :: LinePos ( MovePosition :: End ) , Count :: MinusOne ) ) ,
@@ -1582,7 +1585,7 @@ fn default_keys<I: ApplicationInfo>() -> Vec<(MappedModes, &'static str, InputSt
15821585 ( NMAP , "r" , charreplace ! ( false ) ) ,
15831586 ( NMAP , "R" , insert ! ( InsertStyle :: Replace ) ) ,
15841587 ( NMAP , "s" , change ! ( MoveType :: Column ( MoveDir1D :: Next , false ) ) ) ,
1585- ( NMAP , "S" , change_range ! ( RangeType :: Line ) ) ,
1588+ ( NMAP , "S" , change_range ! ( RangeType :: Line , false ) ) ,
15861589 ( NMAP , "u" , history ! ( HistoryAction :: Undo ( Count :: Contextual ) ) ) ,
15871590 ( NMAP , "U" , unmapped ! ( ) ) ,
15881591 ( NMAP , "x" , edit ! ( EditAction :: Delete , MoveType :: Column ( MoveDir1D :: Next , false ) ) ) ,
@@ -3199,7 +3202,7 @@ mod tests {
31993202
32003203 // Change the current line with "S".
32013204 let op = EditAction :: Delete ;
3202- let mov = rangeop ! ( op, RangeType :: Line ) ;
3205+ let mov = rangeop ! ( op, RangeType :: Line , false ) ;
32033206 ctx. persist . insert = Some ( InsertStyle :: Insert ) ;
32043207 vm. input_key ( key ! ( 'S' ) ) ;
32053208 assert_pop2 ! ( vm, mov, ctx) ;
@@ -3209,6 +3212,19 @@ mod tests {
32093212 vm. input_key ( ctl ! ( 'c' ) ) ;
32103213 assert_insert_exit ! ( vm, ctx) ;
32113214
3215+ // Change the current line with "cc".
3216+ let mov = range ! ( RangeType :: Line , false ) ;
3217+ ctx. persist . insert = Some ( InsertStyle :: Insert ) ;
3218+ ctx. action . operation = EditAction :: Delete ;
3219+ vm. input_key ( key ! ( 'c' ) ) ;
3220+ vm. input_key ( key ! ( 'c' ) ) ;
3221+ assert_pop2 ! ( vm, mov, ctx) ;
3222+ assert_eq ! ( vm. mode( ) , VimMode :: Insert ) ;
3223+
3224+ // Move back to Normal mode via ^C.
3225+ vm. input_key ( ctl ! ( 'c' ) ) ;
3226+ assert_insert_exit ! ( vm, ctx) ;
3227+
32123228 // Pressing c^C should not go to Insert mode.
32133229 ctx. action . operation = EditAction :: Delete ;
32143230 ctx. persist . insert = Some ( InsertStyle :: Insert ) ;
0 commit comments