@@ -372,3 +372,73 @@ describe("add custom filetype with add_custom_filetypes()", function()
372
372
})
373
373
end )
374
374
end )
375
+
376
+ describe (" move to new line" , function ()
377
+ before_each (function ()
378
+ vim .api .nvim_set_option_value (" expandtab" , true , {})
379
+ vim .api .nvim_set_option_value (" shiftwidth" , 4 , {})
380
+ end )
381
+
382
+ it (" true below" , function ()
383
+ debugprint .setup ({move_to_debugline = true })
384
+
385
+ set_lines ({
386
+ " foo" ,
387
+ " bar" ,
388
+ })
389
+
390
+ local filename = write_file (" lua" )
391
+ vim .api .nvim_win_set_cursor (0 , { 1 , 0 })
392
+ feedkeys (" dqp" )
393
+
394
+ check_lines ({
395
+ " foo" ,
396
+ " print('DEBUG[1]: " .. filename .. " :1')" ,
397
+ " bar" ,
398
+ })
399
+
400
+ assert .are .same (vim .api .nvim_win_get_cursor (0 ), {2 , 0 })
401
+ end )
402
+
403
+ it (" true above" , function ()
404
+ debugprint .setup ({move_to_debugline = true })
405
+
406
+ set_lines ({
407
+ " foo" ,
408
+ " bar" ,
409
+ })
410
+
411
+ local filename = write_file (" lua" )
412
+ vim .api .nvim_win_set_cursor (0 , { 1 , 0 })
413
+ feedkeys (" dqP" )
414
+
415
+ check_lines ({
416
+ " print('DEBUG[1]: " .. filename .. " :1')" ,
417
+ " foo" ,
418
+ " bar" ,
419
+ })
420
+
421
+ assert .are .same (vim .api .nvim_win_get_cursor (0 ), {1 , 0 })
422
+ end )
423
+
424
+ it (" false" , function ()
425
+ debugprint .setup ({move_to_debugline = false })
426
+
427
+ set_lines ({
428
+ " foo" ,
429
+ " bar" ,
430
+ })
431
+
432
+ local filename = write_file (" lua" )
433
+ vim .api .nvim_win_set_cursor (0 , { 1 , 0 })
434
+ feedkeys (" dqp" )
435
+
436
+ check_lines ({
437
+ " foo" ,
438
+ " print('DEBUG[1]: " .. filename .. " :1')" ,
439
+ " bar" ,
440
+ })
441
+
442
+ assert .are .same (vim .api .nvim_win_get_cursor (0 ), {1 , 0 })
443
+ end )
444
+ end )
0 commit comments