Compare commits
No commits in common. "1258674a1efa640f555b7e01bba92d0a52f5b085" and "e643bbebcfa24ace2c284ab953c09430663469ad" have entirely different histories.
1258674a1e
...
e643bbebcf
1 changed files with 0 additions and 38 deletions
|
|
@ -182,23 +182,6 @@ local function apply_inline_row(bufnr, row, m, icons)
|
|||
end
|
||||
end
|
||||
|
||||
---@param line string
|
||||
---@return string?
|
||||
local function infer_status(line)
|
||||
local ch = line:match('^/%d+/- %[(.)%]') or line:match('^- %[(.)%]')
|
||||
if not ch then
|
||||
return nil
|
||||
end
|
||||
if ch == 'x' then
|
||||
return 'done'
|
||||
elseif ch == '>' then
|
||||
return 'wip'
|
||||
elseif ch == '=' then
|
||||
return 'blocked'
|
||||
end
|
||||
return 'pending'
|
||||
end
|
||||
|
||||
---@param bufnr integer
|
||||
---@return nil
|
||||
function M.reapply_dirty_inline(bufnr)
|
||||
|
|
@ -208,10 +191,6 @@ function M.reapply_dirty_inline(bufnr)
|
|||
local icons = config.get().icons
|
||||
for row in pairs(_dirty_rows) do
|
||||
local m = _meta[row]
|
||||
if m and m.type == 'task' then
|
||||
local line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1] or ''
|
||||
m.status = infer_status(line) or m.status
|
||||
end
|
||||
if m then
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, ns_inline, row - 1, row)
|
||||
apply_inline_row(bufnr, row - 1, m, icons)
|
||||
|
|
@ -366,25 +345,8 @@ function M.open_line(above)
|
|||
end
|
||||
local row = vim.api.nvim_win_get_cursor(0)[1]
|
||||
local insert_row = above and (row - 1) or row
|
||||
local meta_pos = insert_row + 1
|
||||
|
||||
_rendering = true
|
||||
vim.bo[bufnr].modifiable = true
|
||||
vim.api.nvim_buf_set_lines(bufnr, insert_row, insert_row, false, { '- [ ] ' })
|
||||
_rendering = false
|
||||
|
||||
table.insert(_meta, meta_pos, { type = 'task' })
|
||||
|
||||
local icons = config.get().icons
|
||||
local total = vim.api.nvim_buf_line_count(bufnr)
|
||||
for r = meta_pos, math.min(meta_pos + 1, total) do
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, ns_inline, r - 1, r)
|
||||
local m = _meta[r]
|
||||
if m then
|
||||
apply_inline_row(bufnr, r - 1, m, icons)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_win_set_cursor(0, { insert_row + 1, 6 })
|
||||
vim.cmd('startinsert!')
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue