@@ -301,10 +301,6 @@ function createHandler(
301301 copyYanks ++
302302 state . setRegister ( { text : options ?. copy ?. text ?? "picked" , linewise : false } )
303303 } ,
304- copyYankLine ( ) {
305- copyYanks ++
306- state . setRegister ( { text : options ?. copy ?. text ?? "picked line" , linewise : true } )
307- } ,
308304 copyExit ( scrollToBottom ) {
309305 copyExits . push ( scrollToBottom )
310306 } ,
@@ -2647,7 +2643,7 @@ describe("copy mode", () => {
26472643 expect ( ctx . copyVisualCalls ) . not . toContain ( "char" )
26482644 } )
26492645
2650- test ( "y yanks copy selection and stays in copy mode" , ( ) => {
2646+ test ( "y yanks copy selection and exits copy mode" , ( ) => {
26512647 const ctx = createHandler ( "abc" , { mode : "copy" , copy : { text : "picked text" , isVisual : true } } )
26522648
26532649 const evt = createEvent ( "y" )
@@ -2656,7 +2652,7 @@ describe("copy mode", () => {
26562652 expect ( ctx . copyYanks ( ) ) . toBe ( 1 )
26572653 expect ( ctx . copyCopies ( ) ) . toBe ( 0 )
26582654 expect ( ctx . state . register ( ) ) . toEqual ( { text : "picked text" , linewise : false } )
2659- expect ( ctx . state . mode ( ) ) . toBe ( "copy " )
2655+ expect ( ctx . state . mode ( ) ) . toBe ( "normal " )
26602656 } )
26612657
26622658 test ( "return copies selection to clipboard path and exits copy mode" , ( ) => {
@@ -2880,35 +2876,6 @@ describe("copy mode", () => {
28802876 expect ( ctx . copyExits ) . toEqual ( [ false ] )
28812877 } )
28822878
2883- test ( "y in visual mode yanks and exits visual but stays in copy mode" , ( ) => {
2884- const ctx = createHandler ( "abc" , { mode : "copy" , copy : { text : "selected" , isVisual : true } } )
2885- const evt = createEvent ( "y" )
2886- expect ( ctx . handler . handleKey ( evt . event ) ) . toBe ( true )
2887- expect ( ctx . copyYanks ( ) ) . toBe ( 1 )
2888- expect ( ctx . state . register ( ) ) . toEqual ( { text : "selected" , linewise : false } )
2889- expect ( ctx . state . mode ( ) ) . toBe ( "copy" )
2890- } )
2891-
2892- test ( "y without visual sets pending y for yy" , ( ) => {
2893- const ctx = createHandler ( "abc" , { mode : "copy" } )
2894- const evt = createEvent ( "y" )
2895- expect ( ctx . handler . handleKey ( evt . event ) ) . toBe ( true )
2896- expect ( ctx . state . pending ( ) ) . toBe ( "y" )
2897- expect ( ctx . copyYanks ( ) ) . toBe ( 0 )
2898- expect ( ctx . state . mode ( ) ) . toBe ( "copy" )
2899- } )
2900-
2901- test ( "yy yanks current line and stays in copy mode" , ( ) => {
2902- const ctx = createHandler ( "abc" , { mode : "copy" , copy : { text : "whole line" } } )
2903- ctx . handler . handleKey ( createEvent ( "y" ) . event )
2904- expect ( ctx . state . pending ( ) ) . toBe ( "y" )
2905- ctx . handler . handleKey ( createEvent ( "y" ) . event )
2906- expect ( ctx . state . pending ( ) ) . toBe ( "" )
2907- expect ( ctx . copyYanks ( ) ) . toBe ( 1 )
2908- expect ( ctx . state . register ( ) ) . toEqual ( { text : "whole line" , linewise : true } )
2909- expect ( ctx . state . mode ( ) ) . toBe ( "copy" )
2910- } )
2911-
29122879 test ( "Ctrl+W j from visual in copy mode exits visual not copy" , ( ) => {
29132880 const ctx = createHandler ( "abc" , { mode : "copy" , copy : { isVisual : true } } )
29142881 ctx . handler . handleKey ( createEvent ( "w" , { ctrl : true } ) . event )
0 commit comments