@@ -745,8 +745,9 @@ describe "Operators", ->
745745
746746 describe " the y keybinding" , ->
747747 beforeEach ->
748- editor .getBuffer ().setText (" 012 345\n abc\n " )
748+ editor .getBuffer ().setText (" 012 345\n abc\n defg \ n" )
749749 editor .setCursorScreenPosition ([0 , 4 ])
750+ vimState .setRegister (' "' , text : ' 345' )
750751
751752 describe " when selected lines in visual linewise mode" , ->
752753 beforeEach ->
@@ -857,6 +858,18 @@ describe "Operators", ->
857858 it " leaves the cursor at the starting position" , ->
858859 expect (editor .getCursorScreenPosition ()).toEqual [0 , 4 ]
859860
861+ describe " with an up motion" , ->
862+ beforeEach ->
863+ editor .setCursorScreenPosition ([2 , 2 ])
864+ keydown ' y'
865+ keydown ' k'
866+
867+ it " saves both full lines to the default register" , ->
868+ expect (vimState .getRegister (' "' ).text ).toBe " abc\n defg\n "
869+
870+ it " puts the cursor on the first line and the original column" , ->
871+ expect (editor .getCursorScreenPosition ()).toEqual [1 , 2 ]
872+
860873 describe " when followed by a G" , ->
861874 beforeEach ->
862875 originalText = " 12345\n abcde\n ABCDE"
@@ -913,6 +926,48 @@ describe "Operators", ->
913926 expect (vimState .getRegister (' "' ).text ).toBe ' 123'
914927 expect (editor .getCursorBufferPositions ()).toEqual [[0 , 0 ], [1 , 2 ]]
915928
929+ describe " in a long file" , ->
930+ beforeEach ->
931+ editor .setHeight (400 )
932+ editor .setLineHeightInPixels (10 )
933+ editor .setDefaultCharWidth (10 )
934+ text = " "
935+ for i in [1 .. 200 ]
936+ text += " #{ i} \n "
937+ editor .setText (text)
938+
939+ describe " yanking many lines forward" , ->
940+ it " does not scroll the window" , ->
941+ editor .setCursorBufferPosition [40 , 1 ]
942+ top40 = editor .getScrollTop ()
943+
944+ # yank many lines
945+ keydown (' y' )
946+ keydown (' 1' )
947+ keydown (' 6' )
948+ keydown (' 0' )
949+ keydown (' G' , shift : true )
950+
951+ expect (editor .getScrollTop ()).toEqual (top40)
952+ expect (editor .getCursorBufferPosition ()).toEqual [40 , 1 ]
953+ expect (vimState .getRegister (' "' ).text .split (' \n ' ).length ).toBe 121
954+
955+ describe " yanking many lines backwards" , ->
956+ it " scrolls the window" , ->
957+ editor .setCursorBufferPosition [140 , 1 ]
958+ top140 = editor .getScrollTop ()
959+
960+ # yank many lines
961+ keydown (' y' )
962+ keydown (' 6' )
963+ keydown (' 0' )
964+ keydown (' G' , shift : true )
965+
966+ expect (editor .getScrollTop ()).toNotEqual top140
967+ expect (editor .getCursorBufferPosition ()).toEqual [59 , 1 ]
968+ expect (vimState .getRegister (' "' ).text .split (' \n ' ).length ).toBe 83
969+
970+
916971 describe " the yy keybinding" , ->
917972 describe " on a single line file" , ->
918973 beforeEach ->
0 commit comments