Skip to content

Commit

Permalink
fix(presenter): ensure module.private is not overriden (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamton-aquib authored Sep 2, 2023
1 parent 064f8f6 commit c9dd9f7
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions lua/neorg/modules/core/presenter/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@ module.private = {
nodes = {},
buf = nil,
current_page = 1,

remove_blanklines = function(t)
local copy = t
for k, _t in pairs(copy) do
-- Stops at the first non-blankline text
local found_non_blankline = false

for i = #_t, 1, -1 do
if not found_non_blankline then
local value = _t[i]
value = string.gsub(value, "%s*", "")
if value == "" then
table.remove(copy[k], i)
else
found_non_blankline = true
end
end
end
end
return copy
end,
}

---@class core.presenter
Expand Down Expand Up @@ -221,29 +242,6 @@ module.public = {
end,
}

module.private = {
remove_blanklines = function(t)
local copy = t
for k, _t in pairs(copy) do
-- Stops at the first non-blankline text
local found_non_blankline = false

for i = #_t, 1, -1 do
if not found_non_blankline then
local value = _t[i]
value = string.gsub(value, "%s*", "")
if value == "" then
table.remove(copy[k], i)
else
found_non_blankline = true
end
end
end
end
return copy
end,
}

module.on_event = function(event)
if vim.tbl_contains({ "core.neorgcmd", "core.keybinds" }, event.split_type[1]) then
if vim.tbl_contains({ "presenter.start" }, event.split_type[2]) then
Expand Down

0 comments on commit c9dd9f7

Please sign in to comment.