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:
@@ -915,6 +915,15 @@ vim.defer_fn(function()
|
||||
error('VimwikiMakeDiaryNote missing -count: ' .. vim.inspect(c))
|
||||
end
|
||||
end)
|
||||
-- Diary-note family carries -count=0 (vimwiki's wiki selector), so
|
||||
-- `:2VimwikiMakeDiaryNote` selects wiki #2 instead of raising E481.
|
||||
tobj_case('cmd.VimwikiMakeDiaryNote_has_count', function()
|
||||
local c = vim.api.nvim_buf_get_commands(0, {}).VimwikiMakeDiaryNote
|
||||
if not c then error(':VimwikiMakeDiaryNote not defined') end
|
||||
if c.count == nil or c.count == false then
|
||||
error('VimwikiMakeDiaryNote missing -count: ' .. vim.inspect(c))
|
||||
end
|
||||
end)
|
||||
-- `:VimwikiNormalizeLink 1` (the arg is upstream's visual flag; the command
|
||||
-- is -nargs=? not -range, so no `'<,'>`) wraps the last visual selection.
|
||||
tobj_case('cmd.normalize_link_visual_wraps_selection', function()
|
||||
|
||||
@@ -304,8 +304,8 @@ fix site.
|
||||
same day)_ — upstream's `:Vimwiki{Make,TabMake,MakeYesterday,MakeTomorrow}DiaryNote`
|
||||
+ `VimwikiDiaryIndex` (and the `Nuwiki*` forms) carry `-count=0`, where the
|
||||
count selects the wiki number. _Fix:_ a real wiki selector end-to-end —
|
||||
- Server (`commands.rs`): `OptUriArg` gained an optional `wiki` selector and
|
||||
`resolve_diary_wiki(backend, uri, wiki)` now prefers it (via the existing
|
||||
- Server (`commands.rs`): `OptionalUriArg` gained an optional `wiki` selector
|
||||
and `resolve_diary_wiki(backend, uri, wiki)` now prefers it (via the existing
|
||||
`resolve_wiki_selector`, reused — accepts a 0-indexed number) over the
|
||||
buffer URI; used by `diary_open_relative` + `diary_open_index`.
|
||||
- Clients: `s:diary_open`/`diary_open` (both clients) and
|
||||
|
||||
Reference in New Issue
Block a user