fix(keymap): C-Space toggle fires across all terminal byte spellings
CI / cargo fmt --check (push) Successful in 25s
CI / cargo clippy (push) Successful in 1m5s
CI / cargo test (push) Successful in 1m12s

User reported Ctrl+Space didn't toggle list items. Three things
contributed:

1. **Terminal byte ambiguity.** Different terminals encode Ctrl+Space
   differently — GUI / kitty protocol sends `<C-Space>`, xterm and
   most legacy terms send NUL which Vim sees as `<C-@>` (or, in some
   Neovim builds, `<Nul>` in keymap.lhs). The previous keymap
   registered only `<C-Space>` + `<C-@>`. Added the `<Nul>` alias too
   (both Lua and VimL paths) so the binding fires regardless of what
   byte the user's terminal produces.

2. **Deprecated `vim.lsp.util.make_position_params`.** Neovim 0.12
   requires `position_encoding` explicitly. The old no-arg call now
   prints a deprecation warning, and in stricter setups returns nil
   — which made the command's `arguments` malformed and the
   `executeCommand` request silently fail. `position_params()` now
   pulls `offset_encoding` from the resolved client and passes both
   args, with a `pcall`-guarded fallback to the no-arg form for
   Neovim < 0.10.

3. **Deprecated `client.request(...)` dot-call.** Same Neovim 0.12
   change — `Client:request()` is the method form. Use the colon
   call now; both arities are preserved for back-compat.

Verified end-to-end: feeding all three of `<C-Space>` / `<C-@>` /
`<Nul>` via `nvim_feedkeys` toggles the checkbox; `:messages` no
longer carries the deprecation warnings. 381 tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 01:28:23 +00:00
parent 047c9a3cf3
commit 9d86218b13
3 changed files with 49 additions and 23 deletions
+8 -1
View File
@@ -200,11 +200,18 @@ function M.attach(bufnr, mappings)
-- ===== Lists =====
if on('lists') then
-- Three aliases for the same intent. Terminals disagree about
-- what byte(s) Ctrl+Space produces:
-- * GUI Neovim / kitty-protocol terminals → `<C-Space>`
-- * xterm, most legacy terminals → NUL byte → `<C-@>`
-- * Some Neovim builds spell that same byte `<Nul>` in keymaps
-- Map all three so the user gets the binding regardless.
map('n', '<C-Space>', cmd.toggle_list_item, { desc = 'nuwiki: toggle checkbox' }, bufnr)
map('x', '<C-Space>', cmd.toggle_list_item, { desc = 'nuwiki: toggle checkbox' }, bufnr)
-- <C-@> is the terminal byte for C-Space — keep parity with vimwiki.
map('n', '<C-@>', cmd.toggle_list_item, { desc = 'nuwiki: toggle checkbox' }, bufnr)
map('x', '<C-@>', cmd.toggle_list_item, { desc = 'nuwiki: toggle checkbox' }, bufnr)
map('n', '<Nul>', cmd.toggle_list_item, { desc = 'nuwiki: toggle checkbox' }, bufnr)
map('x', '<Nul>', cmd.toggle_list_item, { desc = 'nuwiki: toggle checkbox' }, bufnr)
map('n', 'gnt', cmd.next_task, { desc = 'nuwiki: next unfinished task' }, bufnr)
map('n', 'gln', cmd.cycle_list_item, { desc = 'nuwiki: increment checkbox' }, bufnr)
map('x', 'gln', cmd.cycle_list_item, { desc = 'nuwiki: increment checkbox' }, bufnr)