@@ -190,7 +190,7 @@ describe "TextObjects", ->
190190 describe " the 'ip' text object" , ->
191191 beforeEach ->
192192 editor .setText (" \n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n " )
193- editor .setCursorScreenPosition ([2 , 2 ])
193+ editor .setCursorBufferPosition ([2 , 2 ])
194194
195195 it " applies operators inside the current paragraph in operator-pending mode" , ->
196196
@@ -205,6 +205,17 @@ describe "TextObjects", ->
205205 expect (editorElement .classList .contains (' normal-mode' )).toBe (true )
206206
207207 it " selects inside the current paragraph in visual mode" , ->
208+
209+ keydown (' v' )
210+ keydown (' i' )
211+ keydown (' p' )
212+
213+ expect (editor .getSelectedScreenRange ()).toEqual [[1 , 0 ], [4 , 0 ]]
214+
215+ it " selects between paragraphs in visual mode if invoked on a empty line" , ->
216+ editor .setText (" text\n\n\n\n text\n " )
217+ editor .setCursorBufferPosition ([1 , 0 ])
218+
208219 keydown (' v' )
209220 keydown (' i' )
210221 keydown (' p' )
@@ -213,7 +224,7 @@ describe "TextObjects", ->
213224
214225 describe " the 'ap' text object" , ->
215226 beforeEach ->
216- editor .setText (" text\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n moretext" )
227+ editor .setText (" text\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n\ n moretext" )
217228 editor .setCursorScreenPosition ([3 , 2 ])
218229
219230 it " applies operators around the current paragraph in operator-pending mode" , ->
@@ -222,9 +233,9 @@ describe "TextObjects", ->
222233 keydown (' a' )
223234 keydown (' p' )
224235
225- expect (editor .getText ()).toBe " text\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n moretext"
236+ expect (editor .getText ()).toBe " text\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n\ n moretext"
226237 expect (editor .getCursorScreenPosition ()).toEqual [2 , 0 ]
227- expect (vimState .getRegister (' "' ).text ).toBe " Paragraph-1\n Paragraph-1\n Paragraph-1\n\n "
238+ expect (vimState .getRegister (' "' ).text ).toBe " Paragraph-1\n Paragraph-1\n Paragraph-1\n\n\n "
228239 expect (editorElement .classList .contains (' operator-pending-mode' )).toBe (false )
229240 expect (editorElement .classList .contains (' normal-mode' )).toBe (true )
230241
@@ -233,7 +244,31 @@ describe "TextObjects", ->
233244 keydown (' a' )
234245 keydown (' p' )
235246
236- expect (editor .getSelectedScreenRange ()).toEqual [[2 , 0 ], [6 , 0 ]]
247+ expect (editor .getSelectedScreenRange ()).toEqual [[2 , 0 ], [7 , 0 ]]
248+
249+ it " applies operators around the next paragraph in operator-pending mode when started from a blank/only-whitespace line" , ->
250+ editor .setText (" text\n\n\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n\n moretext" )
251+ editor .setCursorBufferPosition ([1 , 0 ])
252+
253+ keydown (' y' )
254+ keydown (' a' )
255+ keydown (' p' )
256+
257+ expect (editor .getText ()).toBe " text\n\n\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n\n\n moretext"
258+ expect (editor .getCursorScreenPosition ()).toEqual [1 , 0 ]
259+ expect (vimState .getRegister (' "' ).text ).toBe " \n\n\n Paragraph-1\n Paragraph-1\n Paragraph-1\n "
260+ expect (editorElement .classList .contains (' operator-pending-mode' )).toBe (false )
261+ expect (editorElement .classList .contains (' normal-mode' )).toBe (true )
262+
263+ it " selects around the next paragraph in visual mode when started from a blank/only-whitespace line" , ->
264+ editor .setText (" text\n\n\n\n paragraph-1\n paragraph-1\n paragraph-1\n\n\n moretext" )
265+ editor .setCursorBufferPosition ([1 , 0 ])
266+
267+ keydown (' v' )
268+ keydown (' a' )
269+ keydown (' p' )
270+
271+ expect (editor .getSelectedScreenRange ()).toEqual [[1 , 0 ], [7 , 0 ]]
237272
238273 describe " the 'i[' text object" , ->
239274 beforeEach ->
0 commit comments