refactor(forge): remove %l eol specifier, add auto_close config, fix icons
Problem: `%l` was dead code after inline overlays replaced EOL rendering. Auto-close was always on with no opt-out. Forge icon defaults were empty strings. Solution: remove `%l` from the eol format parser and renderer. Add `forge.auto_close` (default `false`) to gate state-pull. Set nerd font icons: `` (GitHub), `` (GitLab), `` (Codeberg). Keep conceal active in insert mode via `concealcursor = 'nic'`.
This commit is contained in:
parent
e764b34ecb
commit
36898898a7
5 changed files with 22 additions and 23 deletions
|
|
@ -379,7 +379,7 @@ end
|
|||
---@param winid integer
|
||||
local function set_win_options(winid)
|
||||
vim.wo[winid].conceallevel = 3
|
||||
vim.wo[winid].concealcursor = 'nc'
|
||||
vim.wo[winid].concealcursor = 'nic'
|
||||
vim.wo[winid].winfixheight = true
|
||||
end
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ end
|
|||
|
||||
---@class pending.EolSegment
|
||||
---@field type 'specifier'|'literal'
|
||||
---@field key? 'c'|'r'|'d'|'l'
|
||||
---@field key? 'c'|'r'|'d'
|
||||
---@field text? string
|
||||
|
||||
---@param fmt string
|
||||
|
|
@ -458,7 +458,7 @@ local function parse_eol_format(fmt)
|
|||
while pos <= len do
|
||||
if fmt:sub(pos, pos) == '%' and pos + 1 <= len then
|
||||
local key = fmt:sub(pos + 1, pos + 1)
|
||||
if key == 'c' or key == 'r' or key == 'd' or key == 'l' then
|
||||
if key == 'c' or key == 'r' or key == 'd' then
|
||||
table.insert(segments, { type = 'specifier', key = key })
|
||||
pos = pos + 2
|
||||
else
|
||||
|
|
@ -485,10 +485,7 @@ local function build_eol_virt(segments, m, icons)
|
|||
for i, seg in ipairs(segments) do
|
||||
if seg.type == 'specifier' then
|
||||
local text, hl
|
||||
if seg.key == 'l' and m.forge_ref then
|
||||
local forge = require('pending.forge')
|
||||
text, hl = forge.format_label(m.forge_ref, m.forge_cache)
|
||||
elseif seg.key == 'c' and m.show_category and m.category then
|
||||
if seg.key == 'c' and m.show_category and m.category then
|
||||
text = icons.category .. ' ' .. m.category
|
||||
hl = 'PendingHeader'
|
||||
elseif seg.key == 'r' and m.recur then
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
---@field instances? string[]
|
||||
|
||||
---@class pending.ForgeConfig
|
||||
---@field auto_close? boolean
|
||||
---@field github? pending.ForgeInstanceConfig
|
||||
---@field gitlab? pending.ForgeInstanceConfig
|
||||
---@field codeberg? pending.ForgeInstanceConfig
|
||||
|
|
@ -154,18 +155,19 @@ local defaults = {
|
|||
},
|
||||
sync = {},
|
||||
forge = {
|
||||
auto_close = false,
|
||||
github = {
|
||||
icon = '',
|
||||
icon = '',
|
||||
issue_format = '%i %o/%r#%n',
|
||||
instances = {},
|
||||
},
|
||||
gitlab = {
|
||||
icon = '',
|
||||
icon = '',
|
||||
issue_format = '%i %o/%r#%n',
|
||||
instances = {},
|
||||
},
|
||||
codeberg = {
|
||||
icon = '',
|
||||
icon = '',
|
||||
issue_format = '%i %o/%r#%n',
|
||||
instances = {},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -396,8 +396,10 @@ function M.refresh(s)
|
|||
if cache then
|
||||
task._extra._forge_cache = cache
|
||||
any_fetched = true
|
||||
local forge_cfg = config.get().forge or {}
|
||||
if
|
||||
(cache.state == 'closed' or cache.state == 'merged')
|
||||
forge_cfg.auto_close
|
||||
and (cache.state == 'closed' or cache.state == 'merged')
|
||||
and (task.status == 'pending' or task.status == 'wip' or task.status == 'blocked')
|
||||
then
|
||||
task.status = 'done'
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ local parse = require('pending.parse')
|
|||
---@field show_category? boolean
|
||||
---@field priority? integer
|
||||
---@field recur? string
|
||||
---@field forge_ref? pending.ForgeRef
|
||||
---@field forge_cache? pending.ForgeCache
|
||||
---@field forge_spans? pending.ForgeLineMeta[]
|
||||
|
||||
---@class pending.views
|
||||
|
|
@ -219,8 +217,6 @@ function M.category_view(tasks)
|
|||
priority = task.priority,
|
||||
overdue = task.status ~= 'done' and task.due ~= nil and parse.is_overdue(task.due) or nil,
|
||||
recur = task.recur,
|
||||
forge_ref = task._extra and task._extra._forge_ref or nil,
|
||||
forge_cache = task._extra and task._extra._forge_cache or nil,
|
||||
forge_spans = compute_forge_spans(task, prefix_len),
|
||||
})
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue