@@ -183,6 +183,12 @@ T['state']['updates `mode`'] = function()
183183
184184 type_keys (' d' , ' t' , ' e' )
185185 eq (get_state ().mode , ' nov' )
186+ type_keys (' V' , ' t' , ' e' )
187+ eq (get_state ().mode , ' V' )
188+ child .ensure_normal_mode ()
189+ -- Ensure dot-repeat does not update mode after the jump
190+ type_keys (' .' )
191+ eq (get_state ().mode , ' V' )
186192 child .lua (' MiniJump.stop_jumping()' )
187193end
188194
@@ -402,7 +408,7 @@ T['Jumping with f/t/F/T']['works in Operator-pending mode'] = new_set({
402408 type_keys (' d' , ' 2' , key , ' e' )
403409 eq (get_lines (), { line_seq [3 ] })
404410
405- -- Just typing `key` shouldn't repeat action
411+ -- Just typing `key` shouldn't repeat motion
406412 local cur_pos = get_cursor ()
407413 type_keys (key )
408414 eq (get_cursor (), cur_pos )
@@ -582,6 +588,32 @@ T['Jumping with f/t/F/T']['can be dot-repeated if did not jump at first'] = func
582588 validate (' dT' , 1 , 5 , ' abcdg' )
583589end
584590
591+ T [' Jumping with f/t/F/T' ][' inside dot-repeat is not affected by regular jumping' ] = function ()
592+ -- Normal mode
593+ local validate = function (keys , key_antagonist , result )
594+ local line = ' _xdxdx1x1xdxdx_'
595+ local tests_forward = key_antagonist == string.upper (key_antagonist )
596+
597+ set_lines ({ line })
598+ set_cursor (1 , tests_forward and 0 or (string.len (line ) - 1 ))
599+
600+ type_keys (keys )
601+ type_keys (tests_forward and ' $' or ' ^' )
602+ type_keys (key_antagonist , ' 1' )
603+ type_keys (' .' )
604+ eq (get_lines (), { result })
605+
606+ -- Ensure there is no jumping
607+ child .lua (' MiniJump.stop_jumping()' )
608+ child .ensure_normal_mode ()
609+ end
610+
611+ validate (' 2dfd' , ' T' , ' x1x1x_' )
612+ validate (' 2dtd' , ' F' , ' dx1xdx_' )
613+ validate (' 2dFd' , ' t' , ' _x1x1x' )
614+ validate (' 2dTd' , ' f' , ' _xdx1xd' )
615+ end
616+
585617T [' Jumping with f/t/F/T' ][' stops prompting for target if hit `<Esc>` or `<C-c>`' ] = new_set ({
586618 parametrize = {
587619 { ' f' , ' <Esc>' },
@@ -878,6 +910,26 @@ T['Repeat jump with ;']['works after jump in Operator-pending mode'] = function(
878910 type_keys (' d' , ' 2f' , ' e' , ' ;' )
879911 eq (get_lines (), { ' 3e4e5e' })
880912 eq (get_cursor (), { 1 , 3 })
913+
914+ -- Like nvim --clean, it does not use the latest dot repeat
915+ set_lines ({ ' 1e2e3e3e4e5e6' })
916+ set_cursor (1 , 0 )
917+
918+ type_keys (' d' , ' 2f' , ' e' )
919+ eq (get_lines (), { ' 3e3e4e5e6' })
920+ eq (get_cursor (), { 1 , 0 })
921+
922+ type_keys (' $' , ' T' , ' 3' )
923+ eq (get_lines (), { ' 3e3e4e5e6' })
924+ eq (get_cursor (), { 1 , 3 })
925+
926+ type_keys (' .' )
927+ eq (get_lines (), { ' 3e36' })
928+ eq (get_cursor (), { 1 , 3 })
929+
930+ type_keys (' ;' )
931+ eq (get_lines (), { ' 3e36' })
932+ eq (get_cursor (), { 1 , 1 })
881933end
882934
883935T [' Repeat jump with ;' ][' works in Operator-pending mode' ] = function ()
0 commit comments