Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 606bb0f

Browse files
fix: #32
break if the current_col is not anymore in the range
1 parent 3eef2b2 commit 606bb0f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/nvim-devdocs/transpiler.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,11 @@ function transpiler:eval_table(node)
335335
for i = 1, #tr_nodes do
336336
local current_col = 1
337337
for j, value in ipairs(result_map[i]) do
338-
local col_len = max_col_len_map[current_col]
339338
local colspan = tonumber(colspan_map[i][j])
339+
local col_len = max_col_len_map[current_col]
340+
341+
if not col_len then break end
342+
340343
result = result .. "| " .. value .. string.rep(" ", col_len - #value + 1)
341344
current_col = current_col + 1
342345

@@ -356,8 +359,11 @@ function transpiler:eval_table(node)
356359
if i == 1 then
357360
current_col = 1
358361
for j = 1, #result_map[i] do
359-
local col_len = max_col_len_map[current_col]
360362
local colspan = tonumber(colspan_map[i][j])
363+
local col_len = max_col_len_map[current_col]
364+
365+
if not col_len then break end
366+
361367
local line = string.rep("-", col_len)
362368
current_col = current_col + 1
363369

0 commit comments

Comments
 (0)