fix(api): populate lhsrawalt in nvim_get_keymap response

Problem:
The `nvim_get_keymap()` function is missing the `lhsrawalt` field in its response for mappings with an alternate key representation. This makes its return value inconsistent with its documented `maparg()`-like structure and its formal type definition.

Solution:
Corrects the `keymap_array` function to pass the alternate mapping keys (`current_maphash->m_alt->m_keys`) to `mapblock_fill_dict`. The argument responsible for this was previously hardcoded to `NULL`.

For example, for a mapping of `<C-x>`, the API will now correctly return both `lhsraw` (`<80><fc>^DX`) and `lhsrawalt` (the alternate form, e.g., `^X`).

(cherry picked from commit d523750de0)
This commit is contained in:
ncrpy
2025-07-07 14:03:09 +09:00
committed by github-actions[bot]
parent 2d3a4154c5
commit 6889f9168b

View File

@ -2894,7 +2894,10 @@ ArrayOf(Dict) keymap_array(String mode, buf_T *buf, Arena *arena)
}
// Check for correct mode
if (int_mode & current_maphash->m_mode) {
kvi_push(mappings, DICT_OBJ(mapblock_fill_dict(current_maphash, NULL, buffer_value,
kvi_push(mappings, DICT_OBJ(mapblock_fill_dict(current_maphash,
current_maphash->m_alt
? current_maphash->m_alt->m_keys : NULL,
buffer_value,
is_abbrev, false, arena)));
}
}