fix(client): VimwikiColorize accepts a range (no more E481 on selection)
Selecting text and running :VimwikiColorize {color} raised
"E481: No range allowed" — Vim prepends '<,'> to the command when invoked
from a visual selection, but the command was defined without -range.
All four colorize command defs (Vim + Neovim, Vimwiki* + Nuwiki*) are now
-range and forward the range count to the handler. A ranged (visual)
invocation wraps the '< / '> selection; a bare invocation wraps the cword.
The x-mode <Leader>wc mapping passes the visual flag explicitly.
The Vim-branch colorize() gained selection support (it was cword-only),
matching the Neovim branch, so both clients wrap a visual selection
identically. visual_selection_range() (Lua) no longer gates on
vim.fn.visualmode() — the explicit visual flag now carries that intent, and
the marks check guards unset selections.
Tests: cmd.Colorize_range_wraps_selection (nvim) and
colorize.{command_wraps_cword,visual_wraps_selection,ranged_command_no_error}
(vim). nvim 268, vim 257+18, all green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -129,11 +129,17 @@ fix site.
|
||||
bug: `colorize()` inferred visual-vs-normal from `vim.fn.visualmode()`, which
|
||||
returns the *last* session visual mode with stale `'<`/`'>` marks — so the
|
||||
normal-mode command wrapped a leftover selection instead of the cword.
|
||||
`colorize(color, visual)` now takes an explicit `visual` flag passed only by
|
||||
the `x`-mode `<Leader>wc` mapping (`lua/nuwiki/keymaps.lua`); the command and
|
||||
normal mapping always wrap the cword. Covered by `cmd.VimwikiColorize_uses_arg`,
|
||||
`cmd.Colorize_ignores_stale_visual_selection`, and
|
||||
`colorize.visual_wraps_selection` in `development/tests/test-keymaps.lua`.
|
||||
`colorize(color, visual)` now takes an explicit `visual` flag; the command and
|
||||
normal mapping always wrap the cword. Third bug: the commands were not
|
||||
`-range`, so selecting text and running `:VimwikiColorize` (which Vim turns
|
||||
into `:'<,'>VimwikiColorize`) raised `E481: No range allowed`. All four
|
||||
command defs are now `-range` and pass the range to the handler — a ranged
|
||||
(visual) invocation wraps the `'<`/`'>` selection on both clients; the
|
||||
`x`-mode `<Leader>wc` mapping passes the visual flag directly. Covered by
|
||||
`cmd.VimwikiColorize_uses_arg`, `cmd.Colorize_ignores_stale_visual_selection`,
|
||||
`colorize.visual_wraps_selection`, `cmd.Colorize_range_wraps_selection` in
|
||||
`test-keymaps.lua` and `colorize.{command_wraps_cword,visual_wraps_selection,
|
||||
ranged_command_no_error}` in `test-keymaps-vim.vim`.
|
||||
- [ ] **`VimwikiTableMoveColumn{Left,Right}` dispatch to different backing names
|
||||
per client** — Vim branch → `table_move_left/right`; Neovim branch →
|
||||
`table_move_column_left/right`. Harmless today (each name exists in its own
|
||||
|
||||
Reference in New Issue
Block a user