ci: format
This commit is contained in:
parent
7f0bd43b34
commit
8f9052bad1
2 changed files with 23 additions and 19 deletions
|
|
@ -175,22 +175,20 @@ local function restore_folds(bufnr)
|
|||
end
|
||||
for _, winid in ipairs(vim.fn.win_findbuf(bufnr)) do
|
||||
local state = _fold_state[winid]
|
||||
if not state or next(state) == nil then
|
||||
goto continue
|
||||
end
|
||||
vim.api.nvim_win_call(winid, function()
|
||||
vim.cmd('normal! zx')
|
||||
local saved = vim.api.nvim_win_get_cursor(0)
|
||||
for lnum, m in ipairs(_meta) do
|
||||
if m.type == 'header' and m.category and state[m.category] then
|
||||
vim.api.nvim_win_set_cursor(0, { lnum, 0 })
|
||||
vim.cmd('normal! zc')
|
||||
if state and next(state) ~= nil then
|
||||
vim.api.nvim_win_call(winid, function()
|
||||
vim.cmd('normal! zx')
|
||||
local saved = vim.api.nvim_win_get_cursor(0)
|
||||
for lnum, m in ipairs(_meta) do
|
||||
if m.type == 'header' and m.category and state[m.category] then
|
||||
vim.api.nvim_win_set_cursor(0, { lnum, 0 })
|
||||
vim.cmd('normal! zc')
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.api.nvim_win_set_cursor(0, saved)
|
||||
end)
|
||||
_fold_state[winid] = nil
|
||||
::continue::
|
||||
vim.api.nvim_win_set_cursor(0, saved)
|
||||
end)
|
||||
_fold_state[winid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,10 @@ describe('parse', function()
|
|||
|
||||
it('resolves due:+2d to today plus 2 days', function()
|
||||
local today = os.date('*t') --[[@as osdate]]
|
||||
local expected = os.date('%Y-%m-%d', os.time({ year = today.year, month = today.month, day = today.day + 2 }))
|
||||
local expected = os.date(
|
||||
'%Y-%m-%d',
|
||||
os.time({ year = today.year, month = today.month, day = today.day + 2 })
|
||||
)
|
||||
local desc, meta = parse.body('Task due:+2d')
|
||||
assert.are.equal('Task', desc)
|
||||
assert.are.equal(expected, meta.due)
|
||||
|
|
@ -123,7 +126,10 @@ describe('parse', function()
|
|||
|
||||
it("returns today + 3 days for '+3d'", function()
|
||||
local today = os.date('*t') --[[@as osdate]]
|
||||
local expected = os.date('%Y-%m-%d', os.time({ year = today.year, month = today.month, day = today.day + 3 }))
|
||||
local expected = os.date(
|
||||
'%Y-%m-%d',
|
||||
os.time({ year = today.year, month = today.month, day = today.day + 3 })
|
||||
)
|
||||
local result = parse.resolve_date('+3d')
|
||||
assert.are.equal(expected, result)
|
||||
end)
|
||||
|
|
@ -139,12 +145,12 @@ describe('parse', function()
|
|||
assert.truthy(result:match('^%d%d%d%d%-%d%d%-%d%d$'))
|
||||
end)
|
||||
|
||||
it("returns nil for garbage input", function()
|
||||
it('returns nil for garbage input', function()
|
||||
local result = parse.resolve_date('notadate')
|
||||
assert.is_nil(result)
|
||||
end)
|
||||
|
||||
it("returns nil for empty string", function()
|
||||
it('returns nil for empty string', function()
|
||||
local result = parse.resolve_date('')
|
||||
assert.is_nil(result)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue