refactor: remove - prefix from task line rendering
Problem: task lines rendered as `- [ ] description` with a redundant markdown list marker prefix that added visual noise. Solution: render task lines as `[ ] description` instead. Update all line generation in `views.lua`, parsing patterns in `buffer.lua`, `diff.lua`, `textobj.lua`, syntax rules, and corresponding specs.
This commit is contained in:
parent
9830ab84a1
commit
a22e09b6a1
9 changed files with 123 additions and 123 deletions
|
|
@ -35,16 +35,16 @@ function M.parse_buffer(lines)
|
|||
|
||||
for i = start, #lines do
|
||||
local line = lines[i]
|
||||
local id, body = line:match('^/(%d+)/(- %[.?%] .*)$')
|
||||
local id, body = line:match('^/(%d+)/(%[.?%] .*)$')
|
||||
if not id then
|
||||
body = line:match('^(- %[.?%] .*)$')
|
||||
body = line:match('^(%[.?%] .*)$')
|
||||
end
|
||||
if line == '' then
|
||||
table.insert(result, { type = 'blank', lnum = i })
|
||||
elseif id or body then
|
||||
local stripped = body:match('^- %[.?%] (.*)$') or body
|
||||
local stripped = body:match('^%[.?%] (.*)$') or body
|
||||
local icons = config.get().icons
|
||||
local state_char = body:match('^- %[(.-)%]') or icons.pending
|
||||
local state_char = body:match('^%[(.-)%]') or icons.pending
|
||||
local priority = state_char == icons.priority and 1 or 0
|
||||
local status
|
||||
if state_char == icons.done then
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ end
|
|||
---@return integer start_col
|
||||
---@return integer end_col
|
||||
function M.inner_task_range(line)
|
||||
local prefix_end = line:find('/') and select(2, line:find('^/%d+/%- %[.%] '))
|
||||
local prefix_end = line:find('/') and select(2, line:find('^/%d+/%[.%] '))
|
||||
if not prefix_end then
|
||||
prefix_end = select(2, line:find('^%- %[.%] ')) or 0
|
||||
prefix_end = select(2, line:find('^%[.%] ')) or 0
|
||||
end
|
||||
local start_col = prefix_end + 1
|
||||
|
||||
|
|
|
|||
|
|
@ -263,8 +263,8 @@ function M.category_view(tasks)
|
|||
for _, task in ipairs(all) do
|
||||
local prefix = '/' .. task.id .. '/'
|
||||
local state = state_char(task)
|
||||
local line = prefix .. '- [' .. state .. '] ' .. task.description
|
||||
local prefix_len = #prefix + #('- [' .. state .. '] ')
|
||||
local line = prefix .. '[' .. state .. '] ' .. task.description
|
||||
local prefix_len = #prefix + #('[' .. state .. '] ')
|
||||
table.insert(lines, line)
|
||||
table.insert(meta, {
|
||||
type = 'task',
|
||||
|
|
@ -320,8 +320,8 @@ function M.priority_view(tasks)
|
|||
for _, task in ipairs(all) do
|
||||
local prefix = '/' .. task.id .. '/'
|
||||
local state = state_char(task)
|
||||
local line = prefix .. '- [' .. state .. '] ' .. task.description
|
||||
local prefix_len = #prefix + #('- [' .. state .. '] ')
|
||||
local line = prefix .. '[' .. state .. '] ' .. task.description
|
||||
local prefix_len = #prefix + #('[' .. state .. '] ')
|
||||
table.insert(lines, line)
|
||||
table.insert(meta, {
|
||||
type = 'task',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue