@@ -1439,13 +1439,8 @@ end
1439
1439
H .is_something_shown = function ()
1440
1440
-- Don't open Starter buffer if Neovim is opened to show something. That is
1441
1441
-- when at least one of the following is true:
1442
- -- - Current buffer has any lines (something opened explicitly).
1443
- -- NOTE: Usage of `line2byte(line('$') + 1) < 0` seemed to be fine, but it
1444
- -- doesn't work if some automated changed was made to buffer while leaving it
1445
- -- empty (returns 2 instead of -1). This was also the reason of not being
1446
- -- able to test with child Neovim process from 'tests/helpers'.
1447
- local lines = vim .api .nvim_buf_get_lines (0 , 0 , - 1 , true )
1448
- if # lines > 1 or (# lines == 1 and lines [1 ]:len () > 0 ) then return true end
1442
+ -- - There are files in arguments (like `nvim foo.txt` with new file).
1443
+ if vim .fn .argc () > 0 then return true end
1449
1444
1450
1445
-- - Several buffers are listed (like session with placeholder buffers). That
1451
1446
-- means unlisted buffers (like from `nvim-tree`) don't affect decision.
@@ -1455,8 +1450,15 @@ H.is_something_shown = function()
1455
1450
)
1456
1451
if # listed_buffers > 1 then return true end
1457
1452
1458
- -- - There are files in arguments (like `nvim foo.txt` with new file).
1459
- if vim .fn .argc () > 0 then return true end
1453
+ -- - Current buffer has any lines (something opened explicitly).
1454
+ -- NOTE: Usage of `line2byte(line('$') + 1) < 0` seemed to be fine, but it
1455
+ -- doesn't work if some automated changed was made to buffer while leaving it
1456
+ -- empty (returns 2 instead of -1). This was also the reason of not being
1457
+ -- able to test with child Neovim process from 'tests/helpers'.
1458
+ local n_lines = vim .api .nvim_buf_line_count (0 )
1459
+ if n_lines > 1 then return true end
1460
+ local first_line = vim .api .nvim_buf_get_lines (0 , 0 , 1 , true )[1 ]
1461
+ if string.len (first_line ) > 0 then return true end
1460
1462
1461
1463
return false
1462
1464
end
0 commit comments