fix(client): VimwikiColorize passes its {color} arg on Neovim + visual fix
The Neovim command defs for :VimwikiColorize / :NuwikiColorize were -nargs=1 but called colorize() without <q-args>, so the colour name was silently dropped and the user was prompted instead (the Vim branch passed it correctly). Pass <q-args>. While verifying, found a second bug in the Lua colorize(): it inferred visual-vs-normal from vim.fn.visualmode(), which returns the *last* visual mode used in the session along with stale '< / '> marks. So running :VimwikiColorize in normal mode after any earlier visual selection wrapped that leftover selection instead of the word under the cursor (produced an empty, misplaced span). colorize(color, visual) now takes an explicit visual flag, passed only by the x-mode <Leader>wc mapping; the command and the normal-mode mapping always wrap the cword. Tests: cmd.VimwikiColorize_uses_arg, cmd.NuwikiColorize_uses_arg, cmd.Colorize_ignores_stale_visual_selection, colorize.visual_wraps_selection in test-keymaps.lua. nvim suite 267, vim suite 254+18, all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -442,7 +442,7 @@ command! -buffer -nargs=? VimwikiGenerateTags lua require('nuwiki.commands'
|
||||
command! -buffer -nargs=1 VimwikiTable lua require('nuwiki.commands').table_insert()
|
||||
command! -buffer VimwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left()
|
||||
command! -buffer VimwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right()
|
||||
command! -buffer -nargs=1 VimwikiColorize lua require('nuwiki.commands').colorize()
|
||||
command! -buffer -nargs=1 VimwikiColorize lua require('nuwiki.commands').colorize(<q-args>)
|
||||
command! -buffer VimwikiPasteLink lua require('nuwiki.commands').paste_link()
|
||||
command! -buffer VimwikiPasteUrl lua require('nuwiki.commands').paste_url()
|
||||
command! -buffer VimwikiCatUrl lua require('nuwiki.commands').cat_url()
|
||||
@@ -514,7 +514,7 @@ command! -buffer NuwikiTableAlign lua require('nuwiki.command
|
||||
command! -buffer -nargs=1 NuwikiTable lua require('nuwiki.commands').table_insert()
|
||||
command! -buffer NuwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left()
|
||||
command! -buffer NuwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right()
|
||||
command! -buffer -nargs=1 NuwikiColorize lua require('nuwiki.commands').colorize()
|
||||
command! -buffer -nargs=1 NuwikiColorize lua require('nuwiki.commands').colorize(<q-args>)
|
||||
command! -buffer NuwikiPasteLink lua require('nuwiki.commands').paste_link()
|
||||
command! -buffer NuwikiPasteUrl lua require('nuwiki.commands').paste_url()
|
||||
command! -buffer NuwikiCatUrl lua require('nuwiki.commands').cat_url()
|
||||
|
||||
Reference in New Issue
Block a user