Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return a String instead of a PathBuf in nvim_buf_get_name #115

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/oxi-api/src/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;
use std::ops::RangeBounds;
use std::path::{Path, PathBuf};
use std::path::Path;
use std::result::Result as StdResult;

use oxi_luajit::{self as lua, Poppable, Pushable};
Expand Down Expand Up @@ -365,15 +365,15 @@ impl Buffer {

/// Binding to [`nvim_buf_get_name()`][1].
///
/// Returns the full filepath of the buffer.
/// Returns the name of the buffer.
///
/// [1]: https://neovim.io/doc/user/api.html#nvim_buf_get_name()
pub fn get_name(&self) -> Result<PathBuf> {
pub fn get_name(&self) -> Result<oxi_types::String> {
let mut err = nvim::Error::new();
let name = unsafe {
nvim_buf_get_name(self.0, core::ptr::null_mut(), &mut err)
};
choose!(err, Ok(name.into()))
choose!(err, Ok(name))
}

/// Binding to [`nvim_buf_get_offset()`][1].
Expand Down