@@ -343,6 +343,25 @@ describe('renderer.scroll_to_bottom', function()
343343 assert .equals (51 , cursor [1 ])
344344 config .values .ui .output .always_scroll_to_bottom = false
345345 end )
346+
347+ it (' moves to the visual end when the last wrapped line grows' , function ()
348+ local long_line = string.rep (' x' , 120 )
349+ local longer_line = string.rep (' x' , 180 )
350+
351+ vim .api .nvim_win_set_width (win , 20 )
352+ vim .api .nvim_set_option_value (' wrap' , true , { win = win , scope = ' local' })
353+ vim .api .nvim_buf_set_lines (buf , 0 , - 1 , false , { ' line 1' , ' line 2' , long_line })
354+ ctx .prev_line_count = 3
355+ vim .api .nvim_win_set_cursor (win , { 3 , 0 })
356+
357+ renderer .scroll_to_bottom ()
358+ vim .api .nvim_buf_set_lines (buf , 2 , 3 , false , { longer_line })
359+ renderer .scroll_to_bottom ()
360+
361+ local cursor = vim .api .nvim_win_get_cursor (win )
362+ assert .equals (3 , cursor [1 ])
363+ assert .equals (# longer_line - 1 , cursor [2 ])
364+ end )
346365end )
347366
348367describe (' ui.focus_input' , function ()
0 commit comments