Skip to content

Commit

Permalink
fix: return a String instead of a PathBuf in nvim_buf_get_name
Browse files Browse the repository at this point in the history
  • Loading branch information
NyCodeGHG committed Oct 3, 2023
1 parent 11fa6b2 commit 46931b1
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 46931b1

Please sign in to comment.