fix(search): graceful no-match + NuwikiSearch alias (re-audit follow-up)
Re-audit of the just-landed command work found one real bug I introduced
and a convention gap:
- VimwikiSearch / VWS raised a raw E480 on a no-match search; upstream
reports it gracefully. Both clients now catch it (try/catch in Vim,
pcall in Neovim) and emit "nuwiki: no match for <pat>".
- Added a NuwikiSearch alias alongside VimwikiSearch/VWS (every other
command carries a Nuwiki* form).
Gap-doc note corrected: nuwiki's search populates + opens the location
list (shows all matches) where upstream jumps to the first match — logged
as a minor presentation divergence rather than claiming exact parity.
Config + mappings re-audits came back clean (no new gaps, no regressions;
table-mapping rewire verified non-recursive, gLH/gLL/gLR present).
Tests: cmd.VimwikiSearch_no_match_graceful, surface.{Vimwiki,Nuwiki}Search.
Neovim 301, Vim 294/18/21 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ let s:both_forms = [
|
||||
\ 'RebuildTags', '2HTML', '2HTMLBrowse', 'All2HTML', 'Rss',
|
||||
\ 'NormalizeLink', 'RenumberList', 'RenumberAllLists',
|
||||
\ 'ListToggle', 'IncrementListItem', 'DecrementListItem',
|
||||
\ 'CatUrl', 'ShowVersion', 'Return', 'Var',
|
||||
\ 'CatUrl', 'ShowVersion', 'Return', 'Var', 'Search',
|
||||
\ ]
|
||||
for s:suffix in s:both_forms
|
||||
for s:prefix in ['Nuwiki', 'Vimwiki']
|
||||
@@ -692,6 +692,18 @@ call s:record(
|
||||
\ 'cmd.search_and_tablealign_nargs',
|
||||
\ 'err=' . s:attr_err)
|
||||
|
||||
" A no-match search must be caught (friendly message), not raise a raw E480.
|
||||
let s:nm_err = ''
|
||||
try
|
||||
VimwikiSearch zzznomatchxyzqqq
|
||||
catch /E480/
|
||||
let s:nm_err = v:exception
|
||||
catch
|
||||
" other errors (no wiki files, etc.) are fine — only E480 is the regression.
|
||||
endtry
|
||||
call s:record(s:nm_err ==# '' ? 1 : 0,
|
||||
\ 'cmd.VimwikiSearch_no_match_graceful', 'err=' . s:nm_err)
|
||||
|
||||
" ===== :VimwikiGoto -nargs=* =====
|
||||
" Was -nargs=1, so a page name with a space raised E488 (and the empty-arg
|
||||
" prompt fallback was unreachable). Now -nargs=*: a multi-word arg must parse.
|
||||
|
||||
@@ -139,7 +139,7 @@ vim.defer_fn(function()
|
||||
'RebuildTags', '2HTML', '2HTMLBrowse', 'All2HTML', 'Rss',
|
||||
'NormalizeLink', 'RenumberList', 'RenumberAllLists',
|
||||
'ListToggle', 'IncrementListItem', 'DecrementListItem',
|
||||
'CatUrl', 'ShowVersion', 'Return', 'Var',
|
||||
'CatUrl', 'ShowVersion', 'Return', 'Var', 'Search',
|
||||
}
|
||||
for _, suffix in ipairs(both_forms) do
|
||||
for _, prefix in ipairs({ 'Nuwiki', 'Vimwiki' }) do
|
||||
|
||||
Reference in New Issue
Block a user