Bind to nvim_win_set_hl_ns instead of nvim_win_set_hl (#220)

This commit is contained in:
MarcusGrass 2025-03-05 10:54:23 +01:00 committed by GitHub
parent f751ef4324
commit 6a2483cb4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View file

@ -108,9 +108,9 @@ extern "C" {
err: *mut Error,
);
// https://github.com/neovim/neovim/blob/master/src/nvim/api/window.c#L456
// https://github.com/neovim/neovim/blob/release-0.10/src/nvim/api/window.c#L464
#[cfg(feature = "neovim-0-10")] // On 0.10 and nightly.
pub(crate) fn nvim_win_set_hl(
pub(crate) fn nvim_win_set_hl_ns(
win: WinHandle,
ns_id: Integer,
err: *mut Error,

View file

@ -348,7 +348,7 @@ impl Window {
choose!(err, ())
}
/// Binding to [`nvim_win_set_hl()`][1].
/// Binding to [`nvim_win_set_hl_ns()`][1].
///
/// Sets the highlight namespace for this window. This will the highlights
/// defined with [`set_hl`](crate::set_hl) for the given namespace, but
@ -356,15 +356,15 @@ impl Window {
///
/// This takes precedence over the `winhighlight` option.
///
/// [1]: https://neovim.io/doc/user/api.html#nvim_win_set_hl()
/// [1]: https://neovim.io/doc/user/api.html#nvim_win_set_hl_ns()
#[cfg(feature = "neovim-0-10")] // On 0.10 and nightly.
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "neovim-0-10", feature = "neovim-nightly")))
)]
pub fn set_hl(&mut self, ns_id: u32) -> Result<()> {
pub fn set_hl_ns(&mut self, ns_id: u32) -> Result<()> {
let mut err = nvim::Error::new();
unsafe { nvim_win_set_hl(self.0, ns_id.into(), &mut err) };
unsafe { nvim_win_set_hl_ns(self.0, ns_id.into(), &mut err) };
choose!(err, ())
}