mirror of
https://github.com/neovim/neovim.git
synced 2026-01-03 09:56:25 +10:00
fix(man.lua): show_toc condition may cause infinite loop #36979
`lnum` gets set with `vim.fn.nextnonblank`, which returns 0 on failure,
and which is truthy on Lua.
(cherry picked from commit 46220afef8)
This commit is contained in:
committed by
github-actions[bot]
parent
6f84ea7c66
commit
df9452ea9e
@@ -795,7 +795,7 @@ function M.show_toc()
|
||||
|
||||
local lnum = 2
|
||||
local last_line = fn.line('$') - 1
|
||||
while lnum and lnum < last_line do
|
||||
while lnum > 0 and lnum < last_line do
|
||||
local text = fn.getline(lnum)
|
||||
if text:match('^%s+[-+]%S') or text:match('^ %S') or text:match('^%S') then
|
||||
toc[#toc + 1] = {
|
||||
|
||||
Reference in New Issue
Block a user