Skip to content

Commit 7a30898

Browse files
Removed duplicate variable using the :range() call.
1 parent 11dd03e commit 7a30898

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/render-markdown/integ/source.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ function M.list_prefix(row, node)
2626
return '' -- Don't run if on the same line, entry should already have a list marker.
2727
end
2828

29-
local start_row = select(1, marker:range())
3029
-- Retrieve the line from the buffer
31-
local marker_line = vim.api.nvim_buf_get_lines(0, start_row, start_row + 1, false)[1]
30+
local marker_line = vim.api.nvim_buf_get_lines(0, marker_row, marker_row + 1, false)[1]
3231

3332
if not marker_line or #marker_line == 0 then
3433
return '' -- Return empty if the line is empty or doesn't exist
@@ -69,12 +68,13 @@ function M.items(buf, row, col)
6968
table.insert(items, M.item(component.raw, component.rendered, nil))
7069
end
7170
elseif node:type() == 'list_item' or vim.tbl_contains(list_markers, node:type()) then
72-
local list_prefix = M.list_prefix(row, node)
71+
local last_marker = M.list_prefix(row, node)
72+
print(last_marker)
7373
local checkbox = config.checkbox
74-
table.insert(items, M.item(list_prefix .. '[ ] ', checkbox.unchecked.icon, 'unchecked'))
75-
table.insert(items, M.item(list_prefix .. '[x] ', checkbox.checked.icon, 'checked'))
74+
table.insert(items, M.item(last_marker .. '[ ] ', checkbox.unchecked.icon, 'unchecked'))
75+
table.insert(items, M.item(last_marker .. '[x] ', checkbox.checked.icon, 'checked'))
7676
for name, component in pairs(checkbox.custom) do
77-
table.insert(items, M.item(list_prefix .. component.raw .. ' ', component.rendered, name))
77+
table.insert(items, M.item(component.raw, component.rendered, name))
7878
end
7979
end
8080
return items

0 commit comments

Comments
 (0)