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:
@@ -310,9 +310,16 @@ end
|
||||
|
||||
-- ===== Diary =====
|
||||
|
||||
-- `count` is vimwiki's diary `-count` — a wiki number (1-indexed at the user
|
||||
-- level). When > 0 the server acts on that wiki (`wiki = count - 1`) instead
|
||||
-- of the buffer's. next/prev ignore it.
|
||||
local function _diary_open(cmd_name, tab)
|
||||
return function()
|
||||
exec(cmd_name, uri_args(), function(r)
|
||||
return function(count)
|
||||
local args = uri_args()
|
||||
if count and count > 0 then
|
||||
args[1].wiki = count - 1
|
||||
end
|
||||
exec(cmd_name, args, function(r)
|
||||
if r and r.uri then open_uri(r.uri, tab) end
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user