fix(diary): complete the -count wiki selector (repair 874bdd0)
874bdd0 committed the diary -count feature with several Edits that had
silently no-matched, leaving the tree non-compiling and the clients
inconsistent (CI run 236 failed). This completes it:
- commands.rs: add the `wiki` field to OptionalUriArg (the previous edit
targeted a wrong struct name) and pass None to the six resolve_diary_wiki
callers that take no selector (date/list/step paths). Server builds clean.
- autoload/nuwiki/commands.vim + lua/nuwiki/commands.lua: actually thread the
count through s:diary_open / _diary_open and the diary_today/today_tab/
yesterday/tomorrow/index handlers (these edits had failed before, so the
ftplugin defs were calling handlers that ignored/rejected the arg).
- Add the test cases the prior commit referenced but never landed:
cmd.VimwikiMakeDiaryNote_has_count (test-keymaps.lua) +
cmd.Vimwiki{MakeDiaryNote,DiaryIndex}_accepts_count (test-keymaps-vim.vim).
- Fix the OptUriArg→OptionalUriArg name in the gap-doc note.
Verified with CI flags: workspace test/clippy/fmt clean; lua 284, vim 272/18/21,
all 0 failed; the three new diary cases pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -419,32 +419,37 @@ endfunction
|
||||
|
||||
" ===== Diary =====
|
||||
|
||||
function! s:diary_open(cmd_name, ...) abort
|
||||
let l:open = a:0 >= 1 ? a:1 : 'edit'
|
||||
call s:exec(a:cmd_name, [{ 'uri': s:buf_uri() }],
|
||||
\ {n -> s:open_uri_from(n, l:open)})
|
||||
" `a:open` is the window command ('edit'/'tabedit'); `a:count` is vimwiki's
|
||||
" diary `-count` — a wiki number (1-indexed at the user level). When > 0 the
|
||||
" server acts on that wiki instead of the buffer's.
|
||||
function! s:diary_open(cmd_name, open, count) abort
|
||||
let l:arg = { 'uri': s:buf_uri() }
|
||||
if a:count > 0
|
||||
let l:arg['wiki'] = a:count - 1
|
||||
endif
|
||||
call s:exec(a:cmd_name, [l:arg], {n -> s:open_uri_from(n, a:open)})
|
||||
endfunction
|
||||
|
||||
function! nuwiki#commands#diary_today() abort
|
||||
call s:diary_open('nuwiki.diary.openToday')
|
||||
function! nuwiki#commands#diary_today(...) abort
|
||||
call s:diary_open('nuwiki.diary.openToday', 'edit', a:0 >= 1 ? a:1 : 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_today_tab() abort
|
||||
call s:diary_open('nuwiki.diary.openToday', 'tabedit')
|
||||
function! nuwiki#commands#diary_today_tab(...) abort
|
||||
call s:diary_open('nuwiki.diary.openToday', 'tabedit', a:0 >= 1 ? a:1 : 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_yesterday() abort
|
||||
call s:diary_open('nuwiki.diary.openYesterday')
|
||||
function! nuwiki#commands#diary_yesterday(...) abort
|
||||
call s:diary_open('nuwiki.diary.openYesterday', 'edit', a:0 >= 1 ? a:1 : 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_tomorrow() abort
|
||||
call s:diary_open('nuwiki.diary.openTomorrow')
|
||||
function! nuwiki#commands#diary_tomorrow(...) abort
|
||||
call s:diary_open('nuwiki.diary.openTomorrow', 'edit', a:0 >= 1 ? a:1 : 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_index() abort
|
||||
call s:diary_open('nuwiki.diary.openIndex')
|
||||
function! nuwiki#commands#diary_index(...) abort
|
||||
call s:diary_open('nuwiki.diary.openIndex', 'edit', a:0 >= 1 ? a:1 : 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_next() abort
|
||||
call s:diary_open('nuwiki.diary.next')
|
||||
call s:diary_open('nuwiki.diary.next', 'edit', 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_prev() abort
|
||||
call s:diary_open('nuwiki.diary.prev')
|
||||
call s:diary_open('nuwiki.diary.prev', 'edit', 0)
|
||||
endfunction
|
||||
function! nuwiki#commands#diary_generate_index() abort
|
||||
call s:exec('nuwiki.diary.generateIndex', [{ 'uri': s:buf_uri() }])
|
||||
|
||||
Reference in New Issue
Block a user