@@ -31,7 +31,11 @@ describe('cursor persistence (state)', function()
3131 })
3232
3333 win = vim .api .nvim_open_win (buf , true , {
34- relative = ' editor' , width = 80 , height = 10 , row = 0 , col = 0 ,
34+ relative = ' editor' ,
35+ width = 80 ,
36+ height = 10 ,
37+ row = 0 ,
38+ col = 0 ,
3539 })
3640
3741 state .windows = { output_win = win , output_buf = buf }
@@ -162,7 +166,11 @@ describe('cursor persistence (state)', function()
162166 local buf = vim .api .nvim_create_buf (false , true )
163167 vim .api .nvim_buf_set_lines (buf , 0 , - 1 , false , { ' line1' , ' line2' , ' line3' })
164168 local win = vim .api .nvim_open_win (buf , true , {
165- relative = ' editor' , width = 40 , height = 10 , row = 0 , col = 0 ,
169+ relative = ' editor' ,
170+ width = 40 ,
171+ height = 10 ,
172+ row = 0 ,
173+ col = 0 ,
166174 })
167175 vim .api .nvim_win_set_cursor (win , { 2 , 3 })
168176
@@ -190,7 +198,11 @@ describe('output_window.is_at_bottom', function()
190198 vim .api .nvim_buf_set_lines (buf , 0 , - 1 , false , lines )
191199
192200 win = vim .api .nvim_open_win (buf , true , {
193- relative = ' editor' , width = 80 , height = 10 , row = 0 , col = 0 ,
201+ relative = ' editor' ,
202+ width = 80 ,
203+ height = 10 ,
204+ row = 0 ,
205+ col = 0 ,
194206 })
195207
196208 state .windows = { output_win = win , output_buf = buf }
@@ -241,7 +253,11 @@ describe('output_window.is_at_bottom', function()
241253 it (' returns true for empty buffer' , function ()
242254 local empty_buf = vim .api .nvim_create_buf (false , true )
243255 local empty_win = vim .api .nvim_open_win (empty_buf , true , {
244- relative = ' editor' , width = 40 , height = 5 , row = 0 , col = 0 ,
256+ relative = ' editor' ,
257+ width = 40 ,
258+ height = 5 ,
259+ row = 0 ,
260+ col = 0 ,
245261 })
246262 state .windows = { output_win = empty_win , output_buf = empty_buf }
247263
@@ -255,10 +271,13 @@ describe('output_window.is_at_bottom', function()
255271 vim .api .nvim_win_set_cursor (win , { 50 , 0 })
256272 assert .is_true (output_window .is_at_bottom (win ))
257273
274+ -- Scroll viewport up via winrestview, cursor stays at line 50
258275 pcall (vim .api .nvim_win_call , win , function ()
259276 vim .fn .winrestview ({ topline = 1 })
260277 end )
261278
279+ -- Cursor is still at 50, so is_at_bottom should still be true
280+ -- This is the key behavioral difference from viewport-based check
262281 assert .is_true (output_window .is_at_bottom (win ))
263282 end )
264283end )
@@ -278,7 +297,11 @@ describe('renderer.scroll_to_bottom', function()
278297 vim .api .nvim_buf_set_lines (buf , 0 , - 1 , false , lines )
279298
280299 win = vim .api .nvim_open_win (buf , true , {
281- relative = ' editor' , width = 80 , height = 10 , row = 0 , col = 0 ,
300+ relative = ' editor' ,
301+ width = 80 ,
302+ height = 10 ,
303+ row = 0 ,
304+ col = 0 ,
282305 })
283306
284307 state .windows = { output_win = win , output_buf = buf }
@@ -327,10 +350,18 @@ describe('ui.focus_input', function()
327350 vim .api .nvim_buf_set_lines (output_buf , 0 , - 1 , false , { ' output' })
328351
329352 output_win = vim .api .nvim_open_win (output_buf , true , {
330- relative = ' editor' , width = 40 , height = 5 , row = 0 , col = 0 ,
353+ relative = ' editor' ,
354+ width = 40 ,
355+ height = 5 ,
356+ row = 0 ,
357+ col = 0 ,
331358 })
332359 input_win = vim .api .nvim_open_win (input_buf , true , {
333- relative = ' editor' , width = 40 , height = 5 , row = 6 , col = 0 ,
360+ relative = ' editor' ,
361+ width = 40 ,
362+ height = 5 ,
363+ row = 6 ,
364+ col = 0 ,
334365 })
335366
336367 state .windows = {
@@ -373,7 +404,11 @@ describe('renderer._add_message_to_buffer scrolling', function()
373404 vim .api .nvim_buf_set_lines (buf , 0 , - 1 , false , { ' existing line' })
374405
375406 win = vim .api .nvim_open_win (buf , true , {
376- relative = ' editor' , width = 80 , height = 10 , row = 0 , col = 0 ,
407+ relative = ' editor' ,
408+ width = 80 ,
409+ height = 10 ,
410+ row = 0 ,
411+ col = 0 ,
377412 })
378413
379414 state .windows = { output_win = win , output_buf = buf }
0 commit comments