refactor(buffer): update syntax, extmarks, and render for checkbox format
Problem: syntax patterns matched the old indent/[N] format; right_align virtual text produced a broken layout in narrow windows; the done strikethrough skipped past the ' ' indent leaving '- [x] ' unstyled; render() added undo history entries so 'u' could undo a re-render. Solution: update taskHeader/taskLine patterns for '## '/'- [.]'; rename taskPriority -> taskCheckbox matching '[!]'; switch virt_text_pos to 'eol'; drop the +2 col_start offset so strikethrough covers '- [x] '; guard nvim_buf_set_lines with undolevels=-1 so renders are not undoable. Also fix open_line to insert '- [ ] ' and position cursor at col 6.
This commit is contained in:
parent
fe2ee47b5e
commit
d243d5897a
2 changed files with 15 additions and 12 deletions
|
|
@ -3,12 +3,12 @@ if exists('b:current_syntax')
|
|||
endif
|
||||
|
||||
syntax match taskId /^\/\d\+\// conceal
|
||||
syntax match taskHeader /^\S.*$/ contains=taskId
|
||||
syntax match taskPriority /!\ze / contained
|
||||
syntax match taskLine /^\/\d\+\/ .*$/ contains=taskId,taskPriority
|
||||
syntax match taskHeader /^## .*$/ contains=taskId
|
||||
syntax match taskCheckbox /\[!\]/ contained containedin=taskLine
|
||||
syntax match taskLine /^\/\d\+\/- \[.\] .*$/ contains=taskId,taskCheckbox
|
||||
|
||||
highlight default link taskHeader PendingHeader
|
||||
highlight default link taskPriority PendingPriority
|
||||
highlight default link taskCheckbox PendingPriority
|
||||
highlight default link taskLine Normal
|
||||
|
||||
let b:current_syntax = 'task'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue