fix: add compatibility for Lua 5.1 (#456)
Some architectures don't support LuaJIT. Remove the goto's from the code to be compatible with Neovim built without LuaJIT. Signed-off-by: Julian Ruess <julianonline+github@posteo.de>
This commit is contained in:
parent
fcca212c2e
commit
b39a78959f
2 changed files with 109 additions and 107 deletions
|
|
@ -192,7 +192,11 @@ M.parse = function(bufnr)
|
|||
seen_names[name] = true
|
||||
end
|
||||
end
|
||||
|
||||
for i, line in ipairs(lines) do
|
||||
-- hack to be compatible with Lua 5.1
|
||||
-- use return instead of goto
|
||||
(function()
|
||||
if line:match("^/%d+") then
|
||||
-- Parse the line for an existing entry
|
||||
local result, err = M.parse_line(adapter, line, column_defs)
|
||||
|
|
@ -203,10 +207,10 @@ M.parse = function(bufnr)
|
|||
end_lnum = i,
|
||||
col = 0,
|
||||
})
|
||||
goto continue
|
||||
return
|
||||
elseif result.data.id == 0 then
|
||||
-- Ignore entries with ID 0 (typically the "../" entry)
|
||||
goto continue
|
||||
return
|
||||
end
|
||||
local parsed_entry = result.data
|
||||
local entry = result.entry
|
||||
|
|
@ -226,7 +230,7 @@ M.parse = function(bufnr)
|
|||
end_lnum = i,
|
||||
col = 0,
|
||||
})
|
||||
goto continue
|
||||
return
|
||||
end
|
||||
assert(entry)
|
||||
|
||||
|
|
@ -281,7 +285,7 @@ M.parse = function(bufnr)
|
|||
end_lnum = i,
|
||||
col = 0,
|
||||
})
|
||||
goto continue
|
||||
return
|
||||
end
|
||||
if name ~= "" then
|
||||
local link_pieces = vim.split(name, " -> ", { plain = true })
|
||||
|
|
@ -300,7 +304,7 @@ M.parse = function(bufnr)
|
|||
})
|
||||
end
|
||||
end
|
||||
::continue::
|
||||
end)()
|
||||
end
|
||||
|
||||
for name, child_id in pairs(original_entries) do
|
||||
|
|
|
|||
|
|
@ -626,9 +626,7 @@ local function render_buffer(bufnr, opts)
|
|||
end
|
||||
|
||||
for _, entry in ipairs(entry_list) do
|
||||
if not M.should_display(entry[FIELD_NAME], bufnr) then
|
||||
goto continue
|
||||
end
|
||||
if M.should_display(entry[FIELD_NAME], bufnr) then
|
||||
local cols = M.format_entry_cols(entry, column_defs, col_width, adapter)
|
||||
table.insert(line_table, cols)
|
||||
|
||||
|
|
@ -638,7 +636,7 @@ local function render_buffer(bufnr, opts)
|
|||
jump_idx = #line_table
|
||||
M.set_last_cursor(bufname, nil)
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
local lines, highlights = util.render_table(line_table, col_width)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue